public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59800] New: Compilation with g++ fails when -Ofast -flto is used to compile code using some <random> distribution
@ 2014-01-14  6:01 rionda at gmail dot com
  2014-01-14 12:05 ` [Bug c++/59800] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rionda at gmail dot com @ 2014-01-14  6:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59800

            Bug ID: 59800
           Summary: Compilation with g++ fails when -Ofast -flto is used
                    to compile code using some <random> distribution
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rionda at gmail dot com

Created attachment 31828
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31828&action=edit
Code that fails

The attached code compiles cleanly when using 
g++ -Ofast -Wall -Wextra -Wno-unused-parameter test.cpp test.cpp
and when using
g++ -flto -Wall -Wextra -Wno-unused-parameter test.cpp
but fails when using "g++8 -std=c++11 -Ofast -flto -Wall -Wextra
-Wno-unused-parameter test.cpp" (i.e., when using both -Ofast and -flto).

The reported error is:
test.cpp: In function 'main':
/opt/local/include/gcc48/c++/bits/random.h:2404:60: warning: 'MEM[(struct
normal_distribution *)&my_lognormal + 16B]._M_saved' may be used uninitialized
in this function [-Wmaybe-uninitialized]
         { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
                                                            ^
test.cpp:11:33: note: 'MEM[(struct normal_distribution *)&my_lognormal +
16B]._M_saved' was declared here
  lognormal_distribution<double> my_lognormal(0.0, 1.0);
                                 ^

I am running 
g++-mp-4.8 (MacPorts gcc48 4.8.2_0) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
on Mac OS X 10.6.8
(uname -a : darwin xxxx.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-09 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14  6:01 [Bug c++/59800] New: Compilation with g++ fails when -Ofast -flto is used to compile code using some <random> distribution rionda at gmail dot com
2014-01-14 12:05 ` [Bug c++/59800] " rguenth at gcc dot gnu.org
2014-07-09 19:52 ` rionda at gmail dot com
2014-07-09 20:49 ` manu at gcc dot gnu.org

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).