public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ivo Doko <ivo.doko@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: A possible bug
Date: Tue, 07 Oct 2014 05:01:00 -0000	[thread overview]
Message-ID: <54337368.4070407@gmail.com> (raw)

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). (I already asked in 
mingw-w64-public and was told to ask here instead.)
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/

Compiling the "main.cpp" is fine, unless I remove the "-O2" flag (i.e. 
disable compiler optimisation). Then I get the following build log:
http://pastebin.com/LXRX4Pq4

The same thing happens if I remove "-march=amdfam10".

What the linker seems to specifically be complaining about:
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...? (There is 
no function which does not use all three of these, in order.)

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

-- 
Ivo Doko

             reply	other threads:[~2014-10-07  5:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  5:01 Ivo Doko [this message]
2014-10-07  8:37 ` Ivo Doko
2014-10-07  8:57 ` Jonathan Wakely
2014-10-07  9:16   ` Ivo Doko
2014-10-07 10:45     ` Jonathan Wakely
2014-10-07  9:28   ` Ivo Doko
2014-10-07 10:48     ` Jonathan Wakely
2014-10-07 11:48       ` Ivo Doko
2014-10-07 11:49         ` Ivo Doko
2014-10-07 12:25         ` Jonathan Wakely
2014-10-07 12:25         ` Andrew Haley
2014-10-07 13:55           ` Ivo Doko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54337368.4070407@gmail.com \
    --to=ivo.doko@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).