Bug 11949 - [3.3.1 regression] Compiler segfault with ffmpeg altivec code
Summary: [3.3.1 regression] Compiler segfault with ffmpeg altivec code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: 3.3.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 11981 12042 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-16 15:55 UTC by Jonas Smedegaard
Modified: 2010-12-02 21:59 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-08-16 16:13:38


Attachments
preprocessed file (23.17 KB, application/octet-stream)
2003-08-16 16:00 UTC, Jonas Smedegaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Smedegaard 2003-08-16 15:55:27 UTC
Using up-to-date Debian GNU/Linux unstable and attempting to compile CVS
snapshot of ffmpeg on my 1st generation Apple PowerBook G4 (Tibook) the
following happens:

LANG=C gcc -maltivec -mabi=altivec -Wall -g -DHAVE_AV_CONFIG_H -I..
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o
ppc/idct_altivec.o ppc/idct_altivec.c
ppc/idct_altivec.c:164: internal compiler error: Segmentation fault
Please submit a full bug report,

The mentioned line 164 is the end of this:

static const vector_s16_t constants[5] = {
    (vector_s16_t) AVV(23170, 13573, 6518, 21895, -23170, -21895, 32, 31),
    (vector_s16_t) AVV(16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725),
    (vector_s16_t) AVV(22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521),
    (vector_s16_t) AVV(21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692),
    (vector_s16_t) AVV(19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722)
};

Following your instructions here's the more verbose output:

LANG=C gcc -v -save-temps -maltivec -mabi=altivec -Wall -g -DHAVE_AV_CONFIG_H
-I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o
ppc/idct_altivec.o ppc/idct_altivec.c
Reading specs from /usr/lib/gcc-lib/powerpc-linux/3.3.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-java-gc=boehm --enable-java-awt=xlib
--enable-objc-gc --disable-multilib powerpc-linux
Thread model: posix
gcc version 3.3.2 20030812 (Debian prerelease)
 /usr/lib/gcc-lib/powerpc-linux/3.3.2/cc1 -E -quiet -v -I.. -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 -D__unix__ -D__gnu_linux__
-D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=unix -Asystem=posix
-DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
ppc/idct_altivec.c -maltivec -mabi=altivec -Wall idct_altivec.i
ignoring nonexistent directory "/usr/powerpc-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 ..
 /usr/local/include
 /usr/lib/gcc-lib/powerpc-linux/3.3.2/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/powerpc-linux/3.3.2/cc1 -fpreprocessed idct_altivec.i -quiet
-dumpbase idct_altivec.c -maltivec -mabi=altivec -auxbase-strip
ppc/idct_altivec.o -g -Wall -version -o idct_altivec.s
GNU C version 3.3.2 20030812 (Debian prerelease) (powerpc-linux)
        compiled by GNU C version 3.3.2 20030812 (Debian prerelease).
GGC heuristics: --param ggc-min-expand=55 --param ggc-min-heapsize=48089
ppc/idct_altivec.c:164: internal compiler error: Segmentation fault
Please submit a full bug report,

Please guide me if you need me to do dig up more info or do some tests. I can't
really code myself, only compile written code and mess around with scripts (I do
Debian package maintainance), so spell it out if you want me to use a debugger
or other woodo.

(hmm - let's see if I can figure out how to attach the *.i.bz2 file to this
bugreport when filed, there is no "attach" button on the current page...)
Comment 1 Jonas Smedegaard 2003-08-16 16:00:06 UTC
Created attachment 4615 [details]
preprocessed file
Comment 2 Andrew Pinski 2003-08-16 16:13:37 UTC
Reduced case (you do not have to supply any options):
static const __attribute__((vector_size(16))) signed short constants[5] = {
    (__attribute__((vector_size(16))) signed short) {23170, 13573, 6518, 21895, -23170, -21895, 
32, 31},
    (__attribute__((vector_size(16))) signed short) {16384, 22725, 21407, 19266, 16384, 19266, 
21407, 22725},
    (__attribute__((vector_size(16))) signed short) {22725, 31521, 29692, 26722, 22725, 26722, 
29692, 31521},
    (__attribute__((vector_size(16))) signed short) {21407, 29692, 27969, 25172, 21407, 25172, 
27969, 29692},
    (__attribute__((vector_size(16))) signed short) {19266, 26722, 25172, 22654, 19266, 22654, 
25172, 26722}
};

I can confirm this in 3.3.2 (20030816).  It is already fixed on the mainline.

From Phil's regressio hunter: Search converges between 2003-07-24-3.3 (#174) and 2003-07-
25-3.3 (#175).
I think it was caused by:
2003-07-24  Aldy Hernandez  <aldyh@redhat.com>

        Backport the folling patch.

        2003-04-01  Aldy Hernandez  <aldyh@redhat.com>

        PR/8878
        * expr.c (expand_expr): Handle VECTOR_CST.
        (const_vector_from_tree): New.

        * varasm.c (output_constant): Handle VECTOR_CST.

        * c-typeck.c (digest_init): Build a vector constant from a
        VECTOR_TYPE.

The fix was put on the mainline: Search converges between 2003-05-05-trunk (#287) and 2003-
05-06-trunk (#288).
I think it was
2003-05-05  Aldy Hernandez  <aldyh@redhat.com>

        * testsuite/gcc.c-torture/compile/simd-6.c: New.

        * c-typeck.c (digest_init): Handle arrays of vector constants.   
Comment 3 jonas@jones.dk 2003-08-16 17:11:25 UTC
Subject: Re:  [3.3.1 regression] Compiler segfault with ffmpeg
 altivec code

On 16 Aug 2003 16:13:38 -0000
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT*
> gcc-bugs@gcc.gnu.org.

For your information: I used the web-based Bugzilla form to submit both
original bugreport and attached file, so if nay mail got send to the
wrong address I believe the problem lies in the configuration of
Bugzilla.

If the message was meant for future reply, then I suggest prepending the
text with "When replying to this email, " to avoid confusion like the
above.

Regards,

 - Jonas

Comment 4 Andrew Pinski 2003-08-16 17:26:20 UTC
Do not worry about that part it is only if you reply again (not the first time).  You are the first one 
who got confused about this, I would recommend that this be fixed but what to.
Comment 5 Andrew Pinski 2003-08-19 18:17:12 UTC
*** Bug 11981 has been marked as a duplicate of this bug. ***
Comment 6 Matt Kraai 2003-08-22 16:19:22 UTC
I've backported, bootstrapped, and regression tested the patch from comment #2
and submitted it for approval:

 http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01356.html
Comment 7 Andrew Pinski 2003-08-24 00:11:39 UTC
*** Bug 12042 has been marked as a duplicate of this bug. ***
Comment 8 GCC Commits 2003-10-13 21:18:41 UTC
Subject: Bug 11949

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	doko@gcc.gnu.org	2003-10-13 21:18:38

Modified files:
	gcc            : ChangeLog c-typeck.c 

Log message:
	2003-10-13  Matt Kraai <kraai@alumni.cmu.edu>
	
	PR target/11949
	Backport from mainline:
	
	2003-05-05  Aldy Hernandez  <aldyh@redhat.com>
	
	* testsuite/gcc.c-torture/compile/simd-6.c: New.
	* c-typeck.c (digest_init): Handle arrays of vector constants.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.777&r2=1.16114.2.778
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.213.2.9&r2=1.213.2.10

Comment 9 Andrew Pinski 2003-10-13 21:23:49 UTC
Fixed for 3.3.2.