Bug 33856 - [4.3 Regression] Segfault in create_data_ref/compute_data_dependences_for_loop
Summary: [4.3 Regression] Segfault in create_data_ref/compute_data_dependences_for_loop
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.3.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code
: 34047 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-10-22 07:19 UTC by Martin Michlmayr
Modified: 2007-11-09 22:58 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.2
Known to fail:
Last reconfirmed: 2007-10-27 13:29:28


Attachments
preprocessed source (200.71 KB, application/octet-stream)
2007-10-22 07:21 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2007-10-22 07:19:54 UTC
Current trunk:

(sid)30104:tbm@em64t: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O2 -ftree-vectorize zapping-properties-handler.c
zapping-properties-handler.c: In function 'picture_sizes_load_default':
zapping-properties-handler.c:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Martin Michlmayr 2007-10-22 07:21:52 UTC
Created attachment 14387 [details]
preprocessed source
Comment 2 Martin Michlmayr 2007-10-22 07:22:04 UTC
/* Testcase by Martin Michlmayr <tbm@cyrius.com> */

typedef struct z_key
{
  int key;
  int mask;
} z_key;
typedef struct picture_size
{
  z_key key;
}
picture_size;
void picture_size_new (picture_size *ps)
{
  z_key key;
  ps->key = key;
}
void picture_sizes_load_default (picture_size *ps)
{
  int i;
  for (i = 0; i < 5; ++i)
    picture_size_new (ps);
}
Comment 3 Martin Michlmayr 2007-10-22 07:22:29 UTC
Performing interprocedural optimizations
 <visibility> <early_local_cleanups> <inline> <static-var> <pure-const>Assembling functions:
 picture_size_new picture_sizes_load_default
Program received signal SIGSEGV, Segmentation fault.
create_data_ref (nest=0x2b26f0017be0, memref=0x2b26ef7719c0, stmt=<value optimized out>,
    is_read=1 '\001') at gcc/tree-data-ref.c:746
746       if (DECL_P (base))
(gdb) where
#0  create_data_ref (nest=0x2b26f0017be0, memref=0x2b26ef7719c0, stmt=<value optimized out>,
    is_read=1 '\001') at gcc/tree-data-ref.c:746
#1  0x00000000006eb773 in compute_data_dependences_for_loop (loop=0x2b26f0017be0,
    compute_self_and_read_read_dependences=1 '\001', datarefs=0xff4888,
    dependence_relations=0xff4890) at gcc/tree-data-ref.c:4015
#2  0x0000000000a9af4f in vect_analyze_loop (loop=0x2b26f0017be0)
    at gcc/tree-vect-analyze.c:3170
#3  0x000000000080bcd0 in vectorize_loops () at gcc/tree-vectorizer.c:2501
#4  0x000000000063f247 in execute_one_pass (pass=0xee2d00) at gcc/passes.c:1117
#5  0x000000000063f40c in execute_pass_list (pass=0xee2d00)
    at gcc/passes.c:1170
#6  0x000000000063f41e in execute_pass_list (pass=0xee2b20)
    at gcc/passes.c:1171
#7  0x000000000063f41e in execute_pass_list (pass=0xee1f20)
    at gcc/passes.c:1171
#8  0x0000000000717e0e in tree_rest_of_compilation (fndecl=0x2b26f012aa00)
    at gcc/tree-optimize.c:404
#9  0x000000000089adb2 in cgraph_expand_function (node=0x2b26f012ab00)
    at gcc/cgraphunit.c:1060
#10 0x000000000089c858 in cgraph_optimize () at gcc/cgraphunit.c:1123
#11 0x0000000000414d9e in c_write_global_declarations () at gcc/c-decl.c:8077
#12 0x00000000006bb0b7 in toplev_main (argc=<value optimized out>, argv=<value optimized out>)
    at gcc/toplev.c:1055
#13 0x00002b26efcd3b44 in __libc_start_main () from /lib/libc.so.6
#14 0x00000000004043f9 in _start ()
(gdb)
Comment 4 Martin Michlmayr 2007-10-22 07:22:46 UTC
This didn't happen with trunk from 20070916.
Comment 5 Ira Rosen 2007-10-22 11:52:43 UTC
For the data ref in the testcase, VIEW_CONVERT_EXPR<struct z_key>(0),
get_base_address() (in dr_analyze_alias) returns NULL, which causes the segfault. 

Ira
Comment 6 Jakub Jelinek 2007-10-27 13:29:27 UTC
Testing a patch.
Comment 7 Jakub Jelinek 2007-11-05 08:44:30 UTC
Subject: Bug 33856

Author: jakub
Date: Mon Nov  5 08:44:23 2007
New Revision: 129897

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129897
Log:
	PR tree-optimization/33856
	* tree-data-ref.c (get_references_in_stmt): Don't add
	REFERENCE_CLASS_P trees to references vector if get_base_address
	returns NULL on them.

	* gcc.c-torture/compile/20071027-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20071027-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-data-ref.c

Comment 8 Jakub Jelinek 2007-11-05 08:46:02 UTC
Fixed.
Comment 9 Richard Biener 2007-11-09 22:58:06 UTC
*** Bug 34047 has been marked as a duplicate of this bug. ***