Bug 53373 - [4.8 regression] ICE on valid code with -mavx
Summary: [4.8 regression] ICE on valid code with -mavx
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 53374 53381 53393 53427 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-16 08:54 UTC by Martin Reinecke
Modified: 2012-05-25 18:23 UTC (History)
6 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work: 4.7.1
Known to fail: 4.8.0
Last reconfirmed: 2012-05-16 00:00:00


Attachments
Preprocessed testcase (16.02 KB, application/octet-stream)
2012-05-16 08:54 UTC, Martin Reinecke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Reinecke 2012-05-16 08:54:01 UTC
Created attachment 27417 [details]
Preprocessed testcase

When compiling the attached testcase on an Intel Core i3-2120 with a recent
trunk version of gcc, the compiler segfaults:

/scratch/martin/mysvn/libpsht3>gcc -v -O2 -march=native -c bug.i
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-unknown-linux-gnu
Configured with: /scratch/martin/gccgit/configure --disable-graphite --enable-gold --enable-plugins --prefix=/afs/mpa/data/martin/ugcc --with-libelf=/afs/mpa/data/martin/numlibs64 --enable-languages=c++,fortran --enable-target=all --enable-checking=release --enable-build-with-cxx
Thread model: posix
gcc version 4.8.0 20120516 (experimental) [trunk revision a756f44:a2ddc2d:669c9ede91a14c0cc74b38c1ab923146ac3919b2] (GCC) 
COLLECT_GCC_OPTIONS='-v' '-O2' '-march=native' '-c'
 /afs/mpa/data/martin/ugcc/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/cc1 -fpreprocessed bug.i -march=corei7-avx -mcx16 -msahf -mno-movbe -mno-aes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=corei7-avx -quiet -dumpbase bug.i -auxbase bug -O2 -version -o /tmp/ccLcgfAs.s
GNU C (GCC) version 4.8.0 20120516 (experimental) [trunk revision a756f44:a2ddc2d:669c9ede91a14c0cc74b38c1ab923146ac3919b2] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20120516 (experimental) [trunk revision a756f44:a2ddc2d:669c9ede91a14c0cc74b38c1ab923146ac3919b2], GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (GCC) version 4.8.0 20120516 (experimental) [trunk revision a756f44:a2ddc2d:669c9ede91a14c0cc74b38c1ab923146ac3919b2] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20120516 (experimental) [trunk revision a756f44:a2ddc2d:669c9ede91a14c0cc74b38c1ab923146ac3919b2], GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 03c904a1dcafbbea3957ffe55a6c30c7
libfftpack/fftpack.c: In function 'rfftf':
libfftpack/fftpack.c:799:3: internal compiler error: Segmentation fault
   { if(n!=1) rfftf1(n, r, wsave, wsave+n,(size_t*)(wsave+2*n)); }
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


This ICE seems to have been introduced fairly recently. I didn't encounter it a few days ago.
Comment 1 Richard Biener 2012-05-16 10:05:29 UTC
Confirmed.  Caused by Bernds call-return value stuff.

Program received signal SIGSEGV, Segmentation fault.
0x000000000064528e in save_call_clobbered_regs ()
    at /space/rguenther/src/svn/trunk/gcc/caller-save.c:876
876                       rtx dest = SET_DEST (call_set);
(gdb) p call_set
$1 = (rtx) 0x0
(gdb) call debug_rtx (insn)
(call_insn 1344 1343 1347 114 (parallel [
            (set (reg:DI 0 ax)
                (call (mem:QI (symbol_ref:DI ("memcpy") [flags 0x41] <function_decl 0x7ffff5aab200 memcpy>) [0 memcpy S1 A8])
                    (const_int 0 [0])))
            (unspec [
                    (const_int 2 [0x2])
                ] UNSPEC_CALL_NEEDS_VZEROUPPER)
        ]) libfftpack/fftpack.c:308 632 {*call_value_vzeroupper}
     (expr_list:REG_DEAD (reg:DI 5 di)
        (expr_list:REG_DEAD (reg:DI 4 si)
            (expr_list:REG_DEAD (reg:DI 1 dx)
                (expr_list:REG_UNUSED (reg:DI 0 ax)
                    (expr_list:REG_RETURNED (reg:DI 2 cx [orig:769 ivtmp.2819 ] [769])
                        (expr_list:REG_EH_REGION (const_int 0 [0])
                            (nil)))))))
    (expr_list:REG_FRAME_RELATED_EXPR (set (reg:DI 0 ax)
            (reg:DI 5 di))
        (expr_list:REG_FRAME_RELATED_EXPR (use (reg:DI 5 di))
            (expr_list:REG_FRAME_RELATED_EXPR (use (reg:DI 4 si))
                (expr_list:REG_FRAME_RELATED_EXPR (use (reg:DI 1 dx))
                    (nil))))))
Comment 2 Richard Biener 2012-05-16 10:36:31 UTC
*** Bug 53374 has been marked as a duplicate of this bug. ***
Comment 3 Richard Biener 2012-05-18 10:51:20 UTC
*** Bug 53393 has been marked as a duplicate of this bug. ***
Comment 4 Richard Biener 2012-05-18 10:52:03 UTC
*** Bug 53381 has been marked as a duplicate of this bug. ***
Comment 5 Stupachenko Evgeny 2012-05-18 13:56:56 UTC
14 spec2006 tests also fail after the commit 187459,
(compiled with -O2 -march=corei7 -mtune=corei7 -mavx -m64)
However without -mavx they pass.
Comment 6 John David Anglin 2012-05-20 16:32:57 UTC
Author: danglin
Date: Sun May 20 16:32:50 2012
New Revision: 187695

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187695
Log:
	PR rtl-optimzation/53373
	* config/pa/pa.md (call_symref_pic): Don't expose PIC register save in
	call pattern.  Update split patterns.
	(call_symref_64bit, call_reg_pic, call_reg_64bit, call_val_symref_pic,
	call_val_symref_64bit, call_val_reg_pic, call_val_reg_64bit): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa.md
Comment 7 vincenzo Innocente 2012-05-20 17:10:36 UTC
revision 187695 does not solve PR53393
Comment 8 dave.anglin 2012-05-20 18:21:37 UTC
On 20-May-12, at 1:10 PM, vincenzo.innocente at cern dot ch wrote:

> revision 187695 does not solve PR53393

I didn't say it did and I didn't merge the PRs.  In particular, a PA  
issue
was merged with a x86_64 issue.  For PA, the patch avoids the  
problematic
code in the middle-end and improves call optimization.

There is a generic fix posted for PR53381 that might resolve the x86_64
ICE reported here.   I assume the ICE occurs because the x86_64 call  
pattern
contains an UNSPEC.  See also comment 7 in PR53381.

--
John David Anglin	dave.anglin@bell.net
Comment 9 Andrew Pinski 2012-05-20 19:36:25 UTC
*** Bug 53427 has been marked as a duplicate of this bug. ***
Comment 10 H.J. Lu 2012-05-20 20:07:59 UTC
A small testcase

struct gomp_task {
  void *fn_data;
};
extern void *gomp_malloc (unsigned long int);
void GOMP_task (void (*fn) (void *), void *data,
		void (*cpyfn) (void *, void *),
		long arg_size, long arg_align)
{
  struct gomp_task *task;
  char *arg;
  task = gomp_malloc (sizeof (*task) + arg_size + arg_align - 1);
  __builtin_memcpy (arg, data, arg_size);
  task->fn_data = arg;
}

compiled with -m64 -mavx -O2.
Comment 11 Bernd Schmidt 2012-05-21 21:37:05 UTC
Author: bernds
Date: Mon May 21 21:37:01 2012
New Revision: 187745

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187745
Log:
	PR rtl-optimization/53373
	* caller-save.c (save_call_clobbered_regs): Look into a possible
	PARALLEL manually rather than using single_set on a call insn.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/caller-save.c
Comment 12 vincenzo Innocente 2012-05-23 09:18:02 UTC
gcc build for me with -march=native equivalent to -march=bdver1 (and therefore -mavx)
with the "latest" trunk revision 187789
Comment 13 Bernd Schmidt 2012-05-25 18:23:37 UTC
Fixed.