public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47011] New: ICE when using attribute optimize
@ 2010-12-19 10:17 lcastelli at gmail dot com
  2010-12-19 10:18 ` [Bug c++/47011] " lcastelli at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: lcastelli at gmail dot com @ 2010-12-19 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE when using attribute optimize
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lcastelli@gmail.com
            Target: x86_64-linux-gnu


When compiling the attached file with:
 g++ -O3 -c gcc-crash.cpp

the following error is emitted:
 gcc-crash.cpp: In member function ‘virtual A B::m()’:
 gcc-crash.cpp:7: internal compiler error: in tree_nrv, at tree-nrv.c:143

This happens with gcc 4.4.5 and the current branch on SVN. It doesn't seem to
happen on gcc 4.5.


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

* [Bug c++/47011] ICE when using attribute optimize
  2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
@ 2010-12-19 10:18 ` lcastelli at gmail dot com
  2011-09-20 13:15 ` mat at lcs dot mit.edu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: lcastelli at gmail dot com @ 2010-12-19 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Lorenzo Castelli <lcastelli at gmail dot com> 2010-12-19 10:18:34 UTC ---
Created attachment 22819
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22819
Code to reproduce the error


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

* [Bug c++/47011] ICE when using attribute optimize
  2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
  2010-12-19 10:18 ` [Bug c++/47011] " lcastelli at gmail dot com
@ 2011-09-20 13:15 ` mat at lcs dot mit.edu
  2011-09-20 13:19 ` mat at lcs dot mit.edu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mat at lcs dot mit.edu @ 2011-09-20 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mat Hostetter <mat at lcs dot mit.edu> 2011-09-20 12:31:56 UTC ---
Created attachment 25327
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25327
bug showing ICE with -O, incorrect code without optimization


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

* [Bug c++/47011] ICE when using attribute optimize
  2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
  2010-12-19 10:18 ` [Bug c++/47011] " lcastelli at gmail dot com
  2011-09-20 13:15 ` mat at lcs dot mit.edu
@ 2011-09-20 13:19 ` mat at lcs dot mit.edu
  2021-08-08 16:26 ` [Bug middle-end/47011] " pinskia at gcc dot gnu.org
  2021-08-08 22:23 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mat at lcs dot mit.edu @ 2011-09-20 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Mat Hostetter <mat at lcs dot mit.edu> 2011-09-20 12:32:47 UTC ---
I am seeing the same crash with gcc 4.4.[3456], on x86_64. It works on 4.6.1.

I encountered this crash when simply upgrading to the latest boost (1.47.0),
which uses attribute optimize, so this is likely to affect other people.

But the bug is more surprising and subtle than just the crash. It can silently
generate incorrect code, which took me longer to track down.

If you compile my attached code optimized you get the internal compiler error.
If you compile it unoptimized, g++ silently changes the calling convention for
vector::begin from by-value to by-reference -- but only if a completely
unrelated empty function is marked with attribute optimize! 

In the full example this meant g++ miscompiled std::vector::begin to use the
wrong calling convention, which when linked into other objects expecting the
proper calling convention would cause a crash.


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

* [Bug middle-end/47011] ICE when using attribute optimize
  2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-20 13:19 ` mat at lcs dot mit.edu
@ 2021-08-08 16:26 ` pinskia at gcc dot gnu.org
  2021-08-08 22:23 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47011

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.5.0
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed so closing.

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

* [Bug middle-end/47011] ICE when using attribute optimize
  2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
                   ` (3 preceding siblings ...)
  2021-08-08 16:26 ` [Bug middle-end/47011] " pinskia at gcc dot gnu.org
@ 2021-08-08 22:23 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08 22:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47011

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=60062

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Mat Hostetter from comment #3)
> In the full example this meant g++ miscompiled std::vector::begin to use the
> wrong calling convention, which when linked into other objects expecting the
> proper calling convention would cause a crash.

That was PR 60062.

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

end of thread, other threads:[~2021-08-08 22:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-19 10:17 [Bug c++/47011] New: ICE when using attribute optimize lcastelli at gmail dot com
2010-12-19 10:18 ` [Bug c++/47011] " lcastelli at gmail dot com
2011-09-20 13:15 ` mat at lcs dot mit.edu
2011-09-20 13:19 ` mat at lcs dot mit.edu
2021-08-08 16:26 ` [Bug middle-end/47011] " pinskia at gcc dot gnu.org
2021-08-08 22:23 ` pinskia 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).