Bug 32231 - [4.3 Regression] Segfault in verify_ssa_name
Summary: [4.3 Regression] Segfault in verify_ssa_name
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Andrew Pinski
URL:
Keywords: GC, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-06-06 08:05 UTC by Martin Michlmayr
Modified: 2007-06-07 02:14 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-06-07 01:45:19


Attachments
preprocessed source (128.26 KB, application/octet-stream)
2007-06-06 10:12 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-06-06 08:05:22 UTC
I'm getting the following segfault when I compile the beep-media-player
application with the options -ffast-math -funroll-all-loops  -g -O3:

visualization.c: In function 'vis_send_data':
visualization.c:270: internal compiler error: Segmentation fault
Please submit a full bug report,

The problem is that this segfault doesn't happen with the preprocessed
source, so I've no idea how to report this properly.  Any hints on this?
Comment 1 Martin Michlmayr 2007-06-06 08:06:00 UTC
 g_bit_nth_lsf g_bit_nth_msf g_bit_storage g_trash_stack_push g_trash_stack_pop g_trash_stack_peek g_t
rash_stack_height g_string_append_c_inline strtod strtol strtoul strtoq strtouq strtoll strtoull atof
atoi atol atoll gnu_dev_major {GC 5331k -> 4258k} gnu_dev_minor gnu_dev_makedev __strcspn_c1 __strcspn
_c2 __strcspn_c3 __strspn_c1 __strspn_c2 __strspn_c3 __strpbrk_c2 __strpbrk_c3 __strtok_r_1c __strsep_
1c __strsep_2c __strsep_3c {GC 5536k -> 5068k} {GC 6589k -> 6224k} vprintf getchar getc_unlocked getch
ar_unlocked putchar fputc_unlocked putc_unlocked putchar_unlocked feof_unlocked ferror_unlocked {GC 80
95k -> 7683k} {GC 9991k -> 9391k} {GC 12209k -> 11320k} {GC 14717k -> 13483k} {GC 17529k -> 16296k} ge
t_vis_list get_vis_enabled_list vis_disable_plugin vis_about vis_configure vis_playback_start vis_play
back_stop enable_vis_plugin vis_enabled vis_stringify_enabled_list vis_enable_from_stringified_list ca
lc_stereo_pcm calc_mono_pcm calc_freq calc_mono_freq calc_stereo_freq vis_send_data
Analyzing compilation unit
Performing interprocedural optimizations
 <visibility> <early_local_cleanups> <inline> <static-var> <pure-const> <type-escape-var>Assembling fu
nctions:
 get_vis_list get_vis_enabled_list vis_playback_start vis_playback_stop vis_enable_from_stringified_li
st vis_stringify_enabled_list vis_configure vis_about vis_enabled enable_vis_plugin vis_disable_plugin calc_mono_freq vis_send_data {GC 21223k -> 16452k}
Program received signal SIGSEGV, Segmentation fault.
verify_ssa_name (ssa_name=0xa5a5a5a5a5a5a5a5, is_virtual=0 '\0')
    at gcc/tree-ssa.c:109
109       if (TREE_CODE (ssa_name) != SSA_NAME)
(gdb) where
#0  verify_ssa_name (ssa_name=0xa5a5a5a5a5a5a5a5, is_virtual=0 '\0')
    at gcc/tree-ssa.c:109
#1  0x000000000079905b in verify_ssa (check_modified_stmt=1 '\001')
    at gcc/tree-ssa.c:716
#2  0x000000000060c795 in execute_function_todo (data=<value optimized out>)
    at gcc/passes.c:921
#3  0x000000000060c51b in execute_todo (flags=1053) at gcc/passes.c:945
#4  0x000000000060c9fa in execute_one_pass (pass=0xe37ae0) at gcc/passes.c:1090
#5  0x000000000060cb5c in execute_pass_list (pass=0xe37ae0)
    at gcc/passes.c:1120
#6  0x000000000060cb6e in execute_pass_list (pass=0xe370c0)
    at gcc/passes.c:1121
#7  0x000000000060cb6e in execute_pass_list (pass=0xe36ee0)
    at gcc/passes.c:1121
#8  0x000000000060cb6e in execute_pass_list (pass=0xe36340)
    at gcc/passes.c:1121
#9  0x00000000006da8ef in tree_rest_of_compilation (fndecl=0x2b0eb8ddd800)
    at gcc/tree-optimize.c:406
#10 0x000000000082cf70 in cgraph_expand_function (node=0x2b0eb9a8c800)
    at gcc/cgraphunit.c:1073
#11 0x000000000082eae5 in cgraph_optimize () at gcc/cgraphunit.c:1142
#12 0x0000000000413cbe in c_write_global_declarations () at gcc/c-decl.c:7917
#13 0x00000000006855c8 in toplev_main (argc=<value optimized out>, argv=<value optimized out>)
    at gcc/toplev.c:1064
#14 0x00002b0eb84478e4 in __libc_start_main () from /lib/libc.so.6
#15 0x0000000000403f99 in _start ()
(gdb) call debug_tree (ssa_name)

Program received signal SIGSEGV, Segmentation fault.
print_node (file=0x2b0eb8775840, prefix=0xa8c5c1 "", node=0xa5a5a5a5a5a5a5a5, indent=0)
    at gcc/print-tree.c:185
185       code = TREE_CODE (node);
The program being debugged was signaled while in a function called from GDB.
...
Comment 2 Martin Michlmayr 2007-06-06 08:09:37 UTC
(In reply to comment #0)
> I'm getting the following segfault when I compile the beep-media-player
> application with the options -ffast-math -funroll-all-loops  -g -O3:

Sorry, I forgot one option that's also needed: -ftree-vectorize
Comment 3 Martin Michlmayr 2007-06-06 08:10:09 UTC
For the record, the command to see this is:

/usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -I. -I. -I..    -I/usr/X11R6/include -DPNG_NO_MMX_CODE -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng12   -DPNG_NO_MMX_CODE -I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12    -DDATA_DIR=\"/usr/share/bmp\" -DPLUGIN_DIR=\"/usr/lib/bmp\" -DPLUGINSUBS=\"Output\",\"Input\",\"Effect\",\"General\",\"Visualization\" -DLOCALEDIR=\"/usr/share/locale\" -I../intl -I..  -ffast-math -funroll-all-loops  -g -O3   -ftree-vectorize    -c    visualization.c
Comment 4 Andrew Pinski 2007-06-06 09:01:46 UTC
Since this is obviously caused by GC (look at the backtrace and you have 0xa5a5a5a5....), use "--param ggc-min-expand=0 --param ggc-min-heapsize=0" as options to get a reduced testcase (it might take a little while but you should be able to reproduce it easier).
Comment 5 Richard Biener 2007-06-06 09:02:45 UTC
{GC 21223k -> 16452k}
Program received signal SIGSEGV, Segmentation fault.
verify_ssa_name (ssa_name=0xa5a5a5a5a5a5a5a5, is_virtual=0 '\0')
    at gcc/tree-ssa.c:109
109       if (TREE_CODE (ssa_name) != SSA_NAME)

so it just got collected.  I bet you'll get an ICE instead with checking
enabled.  So, can you nevertheless provide preprocessed source?
Comment 6 Martin Michlmayr 2007-06-06 09:51:08 UTC
(In reply to comment #4)
> Since this is obviously caused by GC (look at the backtrace and you have
> 0xa5a5a5a5....), use "--param ggc-min-expand=0 --param ggc-min-heapsize=0" as
> options to get a reduced testcase (it might take a little while but you should
> be able to reproduce it easier).

You're right, and now I remember you telling me before.  I wonder why I didn't
think of this.  Thanks.
Comment 7 Martin Michlmayr 2007-06-06 09:54:10 UTC
I wonder if this is the same or related to PR29975, see comment
100: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29975#c100
Comment 8 Martin Michlmayr 2007-06-06 10:12:16 UTC
Created attachment 13660 [details]
preprocessed source
Comment 9 Martin Michlmayr 2007-06-06 10:12:31 UTC
Reducing, but this will take a while...
Comment 10 Martin Michlmayr 2007-06-06 17:58:04 UTC
(sid)25696:tbm@em64t: ~] /usr/lib/gcc-snapshot/bin/gcc -ffast-math -O1 -ftree-vectorize --param ggc-min-expand=0 --param ggc-min-heapsize=0 beep-visualization.c
beep-visualization.c: In function 'calc_freq':
beep-visualization.c:3: internal compiler error: Segmentation fault

Testcase:


extern double sqrt (double __x);
calc_freq (int *dest)
{
  float tmp_out[257];
  int i;
  for (i = 0; i < 256; i++)
    dest[i] = sqrt (tmp_out[i]);
}
Comment 11 Andrew Pinski 2007-06-07 01:45:19 UTC
(gdb) p debug_generic_expr (stmt)
D.1980_10 = 0.0

(gdb) p *stmt_ann (stmt)->operands.use_ops.use_ptr.use
$14 = 0xa5a5a5a5

So somebody forgot to update the use cache.
Comment 12 Andrew Pinski 2007-06-07 01:49:55 UTC
I have a fix, there is a missing update_stmt :) at the very end of vectorizable_call after it does:
  /* The call in STMT might prevent it from being removed in dce.  We however
     cannot remove it here, due to the way the ssa name it defines is mapped
     to the new definition.  So just replace rhs of the statement with something
     harmless.  */
  type = TREE_TYPE (scalar_dest);
  GIMPLE_STMT_OPERAND (stmt, 1) = fold_convert (type, integer_zero_node);
Comment 13 Andrew Pinski 2007-06-07 02:12:43 UTC
Subject: Bug 32231

Author: pinskia
Date: Thu Jun  7 02:12:31 2007
New Revision: 125521

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125521
Log:
2007-06-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR tree-opt/32231
        * tree-vect-transform.c (vectorizable_call): Call update_stmt
        after changing the right hand side of the assignment.

2007-06-06  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR tree-opt/32231
        * gcc.target/i386/vectorize4.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/vectorize4.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-transform.c

Comment 14 Andrew Pinski 2007-06-07 02:14:05 UTC
Fixed, thanks for the report.