Bug 37284 - [4.4 Regression] ICE on valid code with -fstrict-aliasing
Summary: [4.4 Regression] ICE on valid code with -fstrict-aliasing
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.0
Assignee: Richard Biener
URL:
Keywords: alias, ice-on-valid-code, wrong-code
Depends on:
Blocks:
 
Reported: 2008-08-29 18:18 UTC by James McKelvey
Modified: 2008-09-18 07:22 UTC (History)
2 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work: 4.3.2
Known to fail:
Last reconfirmed: 2008-08-30 14:07:39


Attachments
Compressed preprocessed source (13.87 KB, application/octet-stream)
2008-08-29 18:21 UTC, James McKelvey
Details
Smaller test case (152 bytes, text/plain)
2008-08-29 18:44 UTC, James McKelvey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James McKelvey 2008-08-29 18:18:59 UTC
Does not ICE without -fstrict-aliasing:

$ g++ -c -fstrict-aliasing PatternDriverTop.cc
In file included from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/i686-pc-cygwin/bits/c++allocator.h:40,
                 from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/bits/allocator.h:54,
                 from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/bits/stl_tree.h:69,
                 from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/set:66,
                 from SeenSet.h:6,
                 from PatternDriverTop.h:6,
                 from PatternDriverTop.cc:2:
/usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/ext/new_allocator.h: In member function 'void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = const PatternDriver::PatternDriverTop*]':
/usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/ext/new_allocator.h:107: error: Unrecognized GIMPLE statement during RTL expansion
<<<change_dynamic_type (const struct PatternDriverTop * *) D.8899)>>>
/usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/ext/new_allocator.h:107: internal compiler error: in gimple_to_tree, at cfgexpand.c:300
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ uname -a
CYGWIN_NT-5.1 MCKELVEY-XP 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin

$ g++ -v
Using built-in specs.
Target: i686-pc-cygwin
Configured with: /cygdrive/f/Home/cvsroot/gcc/configure --verbose --enable-threads --disable-nls --disable-win32-registry --enable-languages=c,c++
Thread model: posix
gcc version 4.4.0 20080826 (experimental) (GCC)

$ alias CONFIGURECVS
alias CONFIGURECVS='/cygdrive/f/Home/cvsroot/gcc/configure     --verbose --enable-threads --disable-nls     --disable-win32-registry --enable-languages=c,c++'

$ alias BUILD
alias BUILD='nice make CFLAGS='\'''\'' BOOT_CFLAGS='\'''\'' LIBCFLAGS='\''-g -O'\''     CXXFLAGS='\''-O'\'' LIBCXXFLAGS='\''-g -O'\''     bootstrap'
Comment 1 James McKelvey 2008-08-29 18:21:09 UTC
Created attachment 16167 [details]
Compressed preprocessed source
Comment 2 Andrew Pinski 2008-08-29 18:22:57 UTC
change_dynamic_type should have been removed.
Comment 3 James McKelvey 2008-08-29 18:44:19 UTC
Created attachment 16168 [details]
Smaller test case
Comment 4 Richard Biener 2008-08-30 08:35:13 UTC
Confirmed.
Comment 5 Richard Biener 2008-08-30 08:37:39 UTC
Mine.  It's only a may_alias pass that ever removes the change_dynamic_type
trees.  As this removal fixes up DECL_POINTER_ALIAS_SET this may even cause
wrong code to be emitted during RTL optimization.
Comment 6 Richard Biener 2008-09-18 07:22:43 UTC
Fixed.
Comment 7 Richard Biener 2008-09-18 07:23:54 UTC
Subject: Bug 37284

Author: rguenth
Date: Thu Sep 18 12:52:31 2008
New Revision: 140453

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140453
Log:
2008-09-18  Richard Guenther  <rguenther@suse.de>

	PR middle-end/37284
	* tree-cfg.c (remove_useless_stmts_1): Remove
	GIMPLE_CHANGE_DYNAMIC_TYPE if not optimizing.

	* g++.dg/tree-ssa/pr37284.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr37284.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c