Bug 41573 - [4.5 Regression] segfault in trunk related to strings
Summary: [4.5 Regression] segfault in trunk related to strings
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Michael Matz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-04 21:44 UTC by marcus
Modified: 2020-05-06 13:54 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-10-04 22:04:09


Attachments
msc.i (184 bytes, text/plain)
2009-10-04 21:44 UTC, marcus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marcus 2009-10-04 21:44:07 UTC
simple testcase, extracted from Wine, breaks
$ /home/marcus/projects/gcc.trunk/BIN/bin/gcc -c    -O2  msc.i 
msc.i: In function 'get_attr':
msc.i:13:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
Comment 1 marcus 2009-10-04 21:44:31 UTC
Created attachment 18704 [details]
msc.i

gcc -c -O2 msc.i
Comment 2 Richard Biener 2009-10-04 21:51:49 UTC
#0  0x08b80868 in htab_find_with_hash (htab=0x0, element=0xbfffe9d4, hash=1251)
    at /home/richard/src/trunk/libiberty/hashtab.c:569
#1  0x085c3d49 in referenced_var_check_and_insert (to=0xb7d0eb80)
    at /home/richard/src/trunk/gcc/tree-dfa.c:552
...
#11 0x0865c72c in fold_stmt (gsi=0xbffff140)
    at /home/richard/src/trunk/gcc/tree-ssa-ccp.c:3068
#12 0x085926f5 in remove_useless_stmts_1 (gsi=0xbffff140, data=0xbffff21c)
    at /home/richard/src/trunk/gcc/tree-cfg.c:2199

no referenced-vars during remove_useless_stmts yet.
Comment 3 Michael Matz 2009-10-04 22:04:09 UTC
Gnah.  remove_useless_stmts (notice how that function is called totally
unrelated to what it does) folds the statements.  That's without having
referenced_vars already which is the reason for this segfault after my patches
to fold builtin calls also into multiple statements.  Mine.
Comment 4 Michael Matz 2009-10-08 16:03:32 UTC
Subject: Bug 41573

Author: matz
Date: Thu Oct  8 16:03:11 2009
New Revision: 152563

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152563
Log:
	PR middle-end/41573
	* builtins.c (fold_builtin_isascii): Use fold_build2.
	(fold_builtin_isdigit): Ditto.
	* except.c (duplicate_eh_regions_1): Tolerate NULL labels.
	* tree-cfg.c (struct rus_data, remove_useless_stmts_warn_notreached,
	remove_useless_stmts_cond, remove_useless_stmts_tf,
	remove_useless_stmts_tc, remove_useless_stmts_bind,
	remove_useless_stmts_goto, remove_useless_stmts_label,
	remove_useless_stmts_1, remove_useless_stmts,
	pass_remove_useless_stmts): Remove.
	* tree-pass.h (pass_remove_useless_stmts): Don't declare.
	* passes.c (init_optimization_passes): Don't add
	pass_remove_useless_stmts.
	* tree-eh.c (lower_eh_constructs_2): Handle empty cleanups.
	* tree.c (free_lang_data_in_decl): Don't clear DECL_INITIAL of
	static constants.
	* lto-symtab.c (lto_symtab_register_decl): Accepts DECL_INITIAL
	for static constants.
	* lto-streamer-out.c (output_gimple_stmt): Handle GIMPLE_NOP.
	* lto-streamer-in.c (input_gimple_stmt): Handle GIMPLE_NOP.

testsuite/
	* gcc.dg/tree-ssa/foldstring-1.c: Use fre dump.
	* gcc.dg/tree-ssa/useless-1.c: Use gimple dump.
	* gcc.dg/pr41573.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr41573.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/except.c
    trunk/gcc/lto-streamer-in.c
    trunk/gcc/lto-streamer-out.c
    trunk/gcc/lto-symtab.c
    trunk/gcc/passes.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/foldstring-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/useless-1.c
    trunk/gcc/tree-cfg.c
    trunk/gcc/tree-eh.c
    trunk/gcc/tree-pass.h
    trunk/gcc/tree.c

Comment 5 Michael Matz 2009-10-09 16:04:42 UTC
Fixed.
Comment 6 hjl@gcc.gnu.org 2009-10-15 21:18:22 UTC
Subject: Bug 41573

Author: hjl
Date: Thu Oct 15 21:17:36 2009
New Revision: 152870

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152870
Log:
2009-10-15  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-10-13  Martin Jambor  <mjambor@suse.cz>

	* gcc.c-torture/compile/pr41661.c: New test.

	2009-10-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/41683
	* gfortran.dg/fmt_error_9.f: Add check for repeat count after P.

	2009-10-12  Dodji Seketeli  <dodji@redhat.com>

	PR c++/41570
	* g++.dg/debug/dwarf2/template-params-7.C: New test.

	2009-10-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/41555
	* gcc.dg/torture/pr41555.c: New testcase.

	2009-10-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/41634
	* gcc.c-torture/compile/pr41634.c: New testcase.

	2009-10-08  Michael Matz  <matz@suse.de>

	PR middle-end/41573
	* gcc.dg/pr41573.c: New test.

	2009-10-07  Joseph Myers  <joseph@codesourcery.com>

	PR c/41182
	* gcc.c-torture/compile/pr41182-1.c: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
      - copied unchanged from r152869, trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41634.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.c-torture/compile/pr41634.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41661.c
      - copied unchanged from r152868, trunk/gcc/testsuite/gcc.c-torture/compile/pr41661.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41573.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.dg/pr41573.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr41555.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.dg/torture/pr41555.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/fmt_error_9.f
      - copied unchanged from r152869, trunk/gcc/testsuite/gfortran.dg/fmt_error_9.f
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog