Bug 28498 - fstack-protector causes crash in combination with -Os
Summary: fstack-protector causes crash in combination with -Os
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-07-26 17:40 UTC by Maarten Lankhorst
Modified: 2007-03-09 12:14 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 4.1.0 4.1.1 4.2.0
Last reconfirmed: 2006-07-27 12:48:21


Attachments
The source mentioned in description (118.61 KB, application/octet-stream)
2006-07-26 17:42 UTC, Maarten Lankhorst
Details
reduced testcase (1.18 KB, text/plain)
2006-07-27 12:48 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Lankhorst 2006-07-26 17:40:01 UTC
When compiling c++ code, you can get an error similar to this one:

/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h: In function '_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<QRect*, std::vector<QRect, std::allocator<QRect> > >, _Tp = QRect]':
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2182: internal compiler error: Segmentation fault

according to gcc -v, cc1plus was run with

/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/cc1plus -quiet -v -D_GNU_SOURCE -D__PIC__ -DPIC windowgrabber.cc -fPIC -fstack-protector-all -quiet -dumpbase windowgrabber.cc -mtune=pentiumpro -auxbase windowgrabber -Os -version -fPIC -fstack-protector-all -o /tmp/cchIBKrS.s

I'll attach source
Comment 1 Maarten Lankhorst 2006-07-26 17:42:07 UTC
Created attachment 11949 [details]
The source mentioned in description

Source that won't compile
Comment 2 Richard Biener 2006-07-27 11:31:07 UTC
With checking enabled you get

/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h: In function '_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<QRect*, std::vector<QRect, std::allocator<QRect> > >, _Tp = QRect]':
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2182: error: NOTE_INSN_BASIC_BLOCK is missing for block 1
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2182: error: NOTE_INSN_BASIC_BLOCK 21 in middle of basic block 1
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2182: error: insn outside basic block
(insn 19 17 21 1 (parallel [
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int 12 [0xc])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_algo.h:2182: internal compiler error: in rtl_verify_flow_info, at cfgrtl.c:2250
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

not a regression, since 4.0 did not have -fstack-protector.
Comment 3 Richard Biener 2006-07-27 12:48:08 UTC
Created attachment 11956 [details]
reduced testcase
Comment 4 Richard Biener 2006-07-27 12:48:21 UTC
Confirmed.