I hope inquiring in this mailing list is the right thing to do, but if 
not I apologise.

So let me start with the essentials. The OS I am using is Windows 7 
64-bit. I am using Code::Blocks 13.12 with MinGW-w64 
(x86_64-4.9.1-posix-seh-rt_v3-rev1). For this particular instance I've 
used these compiler options:
-O2 -std=c++11 -Wextra -Wall -march=amdfam10 -pipe -lm -lstdc++

Now that that's out of the way... I have this:
https://sourceforge.net/projects/xorshift-cpp/files/

Yes, it's a lot of code, I know, and it's sort of not commented at all. 
But anyway, with all those source files, compiling the "main.cpp" is 
fine... unless I remove the "-O2" flag (i.e. disable compiler 
optimisation). Then I get the following output: http://pastebin.com/H08qxK84

Long story short:
undefined reference to `xorshift_engine<unsigned long long, 64ull, 
(signed char)-25, (signed char)3, (signed char)49, 
8372773778140471301ull>::shift_3'
undefined reference to `xorshift_engine<unsigned long long, 64ull, 
(signed char)-25, (signed char)3, (signed char)49, 
8372773778140471301ull>::shift_2'

Which makes absolutely no sense, not only because those linker errors 
don't come up when compiling even with just "-O", but because, in 
"xorshift.h", three constexprs in the xorshift_engine class are defined 
like so:

     static constexpr int_fast8_t  shift_1      = a >= 0 ? a : -a;
     static constexpr int_fast8_t  shift_2      = b >= 0 ? b : -b;
     static constexpr int_fast8_t  shift_3      = c >= 0 ? c : -c;

yet shift_1 is ok, but shift_2 and shift_3 somehow aren't...?

This smells like a bug in the compiler to me, but I am not sure. Can 
someone please help me?

--
Ivo Doko

------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to