Bug 997153 - g++ 4.4 compiler segv on static_cast inside enum declaration
g++ 4.4 compiler segv on static_cast inside enum declaration
Status: NEW
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc (Show other bugs)
4.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jakub Jelinek
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-14 15:20 EDT by Ed Brabant
Modified: 2015-05-15 07:29 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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 15:20 EDT, Ed Brabant
no flags Details

  None (edit)
Description Ed Brabant 2013-08-14 15:20:46 EDT
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 07:29:21 EDT
This was fixed by r206716:

2014-01-17  Marek Polacek  <polacek@redhat.com>

       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.

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