Bug 997153 - g++ 4.4 compiler segv on static_cast inside enum declaration
Summary: g++ 4.4 compiler segv on static_cast inside enum declaration
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-14 19:20 UTC by Ed Brabant
Modified: 2018-04-27 22:05 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-27 22:05:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Diagnostic output file from g++ compiler when segv occurred (includes offending source code) (325 bytes, text/x-csrc)
2013-08-14 19:20 UTC, Ed Brabant
no flags Details

Description Ed Brabant 2013-08-14 19:20:46 UTC
Created attachment 786670 [details]
Diagnostic output file from g++ compiler when segv occurred (includes offending source code)

Description of problem:
When attempting to perform a static_cast<Foo>(-1) within the declaration of enum Foo, the compiler incurs a segv

Version-Release number of selected component (if applicable):
Compiler version:  g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
OS version:        CentOS 6.3 (kernel 2.6.32-279.el6.i686)
VMware version:    VMware Player 5.0.1 build-894247
Hardware version:  x86-64 (Dell Optiplex 7010, Intel Core i7-3770 @ 3.4 Ghz)

How reproducible:

Steps to Reproduce:
Extract the source code in the attached file and put in a file named, e.g. bugrepro.cpp and compile with the following command at the Linux shell:
g++ -o bugrepro bugrepro.cpp

Actual results:
g++ compiler outputs the following messages:
"Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccCP2119.out file, please attach this to your bugreport."

Expected results:
Compiles without error, or generates an error message on the console indicating
a static_cast<> with the same data type as the enclosing declaration is illegal.

Additional info:
See attached file.

Comment 1 Marek Polacek 2015-05-15 11:29:21 UTC
This was fixed by r206716:

2014-01-17  Marek Polacek  <polacek>

       PR c++/59838
       * cvt.c (ocp_convert): Don't segfault on non-existing
       ENUM_UNDERLYING_TYPE.

The patch is trivial (but can't be applied cleanly), but the code is invalid.

Comment 2 Marek Polacek 2018-04-27 22:05:18 UTC
...and we're not going to backport anything for ICE-on-invalid.


Note You need to log in before you can comment on or make changes to this bug.