Commit fc558124 authored by Andrew Hsieh's avatar Andrew Hsieh
Browse files

Add testcase for issue 62910

See b.android.com/62910

Change-Id: I704f335196ad5fada578d5edb507952744b36b26
parent eeff448a
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := issue62910-gcc4.8.2-libstdc++-nth-element-segfault
LOCAL_SRC_FILES := issue62910-gcc4.8.2-libstdc++-nth-element-segfault.cpp
LOCAL_CPPFLAGS += -std=gnu++11
include $(BUILD_EXECUTABLE)
APP_ABI := all
APP_STL := gnustl_static
\ No newline at end of file
#include <algorithm>
#include <stdint.h>
#include <iostream>
double to_double(uint64_t x)
{
union {double d; uint64_t x;} u;
u.x = x;
return u.d;
}
int main()
{
std::vector<double> v = {
to_double(4606672070890243784),
to_double(4606672025854247510),
to_double(4606671800674266141),
to_double(4606671575494284772),
to_double(4606672115926240057),
to_double(4606672160962236330),
to_double(4606672070890243784),
};
for (auto i : v)
std::cout << i << std::endl;
std::nth_element(v.begin(), v.begin() + 3, v.end());
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment