public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
@ 2005-08-04  1:30 aaronw at net dot com
  2005-08-04  1:33 ` [Bug c/23222] " aaronw at net dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: aaronw at net dot com @ 2005-08-04  1:30 UTC (permalink / raw)
  To: gcc-bugs

When attempting to compile Xine for Solaris I got the following error: 
 
gcc -O3 -mcpu=ultrasparc -mtune=ultrasparc  -fno-inline-functions -c  
test.c -o test.o 
/var/tmp//cco3qSnO.s: Assembler messages: 
/var/tmp//cco3qSnO.s:464: Error: Illegal operands: There are only 32  
single precision f registers; [0-31] 
 
Note: This only fails if I have both -O3 and -fno-inline-functions set. 
 
gcc -v 
Reading specs  
from /opt/gcc3.3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.6/specs 
Configured with: ../configure --host=sparc-sun-solaris2.8  
--prefix=/opt/gcc3.3 --enable-shared --with-gnu-ld  
--with-ld=/opt/gcc3.3/bin/ld --with-gnu-as --with-as=/opt/gcc3.3/bin/as  
--with-cpu=ultrasparc 
Thread model: posix 
gcc version 3.3.6 
 
I have attached a test case but will include it inlined as well.  This  
is based off of Xine 1.1.0 src/libffmpeg/libavcodec/eval.c 
 
 
===== begin testt.c ===== 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <math.h> 
 
#ifndef NAN 
  #define NAN 0 
#endif 
 
#ifndef M_PI 
#define M_PI 3.14159265358979323846 
#endif 
 
typedef struct Parser{ 
    int stack_index; 
    char *s; 
    double *const_value; 
    const char **const_name;          // NULL terminated 
    double (**func1)(void *, double a); // NULL terminated 
    const char **func1_name;          // NULL terminated 
    double (**func2)(void *, double a, double b); // NULL terminated 
    char **func2_name;          // NULL terminated 
    void *opaque; 
} Parser; 
 
static int strmatch(const char *s, const char *prefix){ 
    int i; 
    for(i=0; prefix[i]; i++){ 
        if(prefix[i] != s[i]) return 0; 
    } 
    return 1; 
} 
 
static double evalPrimary(Parser *p){ 
    double d, d2=NAN; 
    char *next= p->s; 
    int i; 
 
    /* number */ 
    d= strtod(p->s, &next); 
    if(next != p->s){ 
        p->s= next; 
        return d; 
    } 
 
    /* named constants */ 
    for(i=0; p->const_name && p->const_name[i]; i++){ 
        if(strmatch(p->s, p->const_name[i])){ 
            p->s+= strlen(p->const_name[i]); 
            return p->const_value[i]; 
        } 
    } 
 
    p->s= strchr(p->s, '('); 
    if(p->s==NULL){ 
        printf("Parser: missing ( in \"%s\"\n", next); 
        return NAN; 
    } 
    p->s++; // "(" 
    d= evalExpression(p); 
    if(p->s[0]== ','){ 
        p->s++; // "," 
        d2= evalExpression(p); 
    } 
    if(p->s[0] != ')'){ 
        printf("Parser: missing ) in \"%s\"\n", next); 
        return NAN; 
    } 
    p->s++; // ")" 
 
         if( strmatch(next, "sinh"  ) ) d= sinh(d); 
    else if( strmatch(next, "cosh"  ) ) d= cosh(d); 
    else if( strmatch(next, "tanh"  ) ) d= tanh(d); 
    else if( strmatch(next, "sin"   ) ) d= sin(d); 
    else if( strmatch(next, "cos"   ) ) d= cos(d); 
    else if( strmatch(next, "tan"   ) ) d= tan(d); 
    else if( strmatch(next, "exp"   ) ) d= exp(d); 
    else if( strmatch(next, "log"   ) ) d= log(d); 
    else if( strmatch(next, "squish") ) d= 1/(1+exp(4*d)); 
    else if( strmatch(next, "gauss" ) ) d= exp(-d*d/2)/sqrt(2*M_PI); 
    else if( strmatch(next, "abs"   ) ) d= fabs(d); 
    else if( strmatch(next, "max"   ) ) d= d > d2 ? d : d2; 
    else if( strmatch(next, "min"   ) ) d= d < d2 ? d : d2; 
    else if( strmatch(next, "gt"    ) ) d= d > d2 ? 1.0 : 0.0; 
    else if( strmatch(next, "gte"    ) ) d= d >= d2 ? 1.0 : 0.0; 
    else if( strmatch(next, "lt"    ) ) d= d > d2 ? 0.0 : 1.0; 
    else if( strmatch(next, "lte"    ) ) d= d >= d2 ? 0.0 : 1.0; 
    else if( strmatch(next, "eq"    ) ) d= d == d2 ? 1.0 : 0.0; 
    else if( strmatch(next, "("     ) ) d= d; 
//    else if( strmatch(next, "l1"    ) ) d= 1 + d2*(d - 1); 
//    else if( strmatch(next, "sq01"  ) ) d= (d >= 0.0 && d <=1.0) ?  
1.0 : 0.0; 
    else{ 
        for(i=0; p->func1_name && p->func1_name[i]; i++){ 
            if(strmatch(next, p->func1_name[i])){ 
                return p->func1[i](p->opaque, d); 
            } 
        } 
 
        for(i=0; p->func2_name && p->func2_name[i]; i++){ 
            if(strmatch(next, p->func2_name[i])){ 
                return p->func2[i](p->opaque, d, d2); 
            } 
        } 
 
        printf("Parser: unknown function in \"%s\"\n", next); 
        return NAN; 
    } 
 
    return d; 
}

-- 
           Summary: gcc optimization error for sparc with xine/ffmpeg, bad
                    assembly generated
           Product: gcc
           Version: 3.3.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aaronw at net dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
@ 2005-08-04  1:33 ` aaronw at net dot com
  2005-08-04  1:36 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aaronw at net dot com @ 2005-08-04  1:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aaronw at net dot com  2005-08-04 01:33 -------
Created an attachment (id=9425)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9425&action=view)
Test case that creates the problem

gcc -O3 -mcpu=ultrasparc -mtune=ultrasparc  -fno-inline-functions -c 
test.c -o test.o

Note that this test case can probably be further simplified.  There was another
file a lot more complex that was even worse and only needed -O3 to generate the
problem without -fno-inline-functions.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
  2005-08-04  1:33 ` [Bug c/23222] " aaronw at net dot com
@ 2005-08-04  1:36 ` pinskia at gcc dot gnu dot org
  2005-08-04  4:27 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04  1:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-04 01:36 -------
This is a gas bug.

*** This bug has been marked as a duplicate of 15247 ***

*** This bug has been marked as a duplicate of 15247 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
  2005-08-04  1:33 ` [Bug c/23222] " aaronw at net dot com
  2005-08-04  1:36 ` pinskia at gcc dot gnu dot org
@ 2005-08-04  4:27 ` pinskia at gcc dot gnu dot org
  2005-08-04  5:00 ` ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04  4:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-04 04:27 -------
Lets reopen it then.

Could you attach the .s file?
And the preprocessed source, the .i file.

Both can be got by adding -save-temps to the gcc invocation.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (2 preceding siblings ...)
  2005-08-04  4:27 ` pinskia at gcc dot gnu dot org
@ 2005-08-04  5:00 ` ebotcazou at gcc dot gnu dot org
  2005-08-04  5:02 ` ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-08-04  5:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (3 preceding siblings ...)
  2005-08-04  5:00 ` ebotcazou at gcc dot gnu dot org
@ 2005-08-04  5:02 ` ebotcazou at gcc dot gnu dot org
  2005-08-04  5:28 ` aaronw at attbi dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-08-04  5:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-08-04 05:01 -------
Please attach the generated assembly file.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (4 preceding siblings ...)
  2005-08-04  5:02 ` ebotcazou at gcc dot gnu dot org
@ 2005-08-04  5:28 ` aaronw at attbi dot com
  2005-08-04  6:18 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aaronw at attbi dot com @ 2005-08-04  5:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aaronw at attbi dot com  2005-08-04 05:28 -------
Interesting... it assembles with binutils as 2.12.1... could this be another
binutils bug?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (5 preceding siblings ...)
  2005-08-04  5:28 ` aaronw at attbi dot com
@ 2005-08-04  6:18 ` ebotcazou at gcc dot gnu dot org
  2005-08-04  6:25 ` aaron_williams at net dot com
  2005-08-04 13:14 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-08-04  6:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-08-04 06:18 -------
The test.s file assembles fine on my machine with GNU as 2.16.  Could you
compile the test.i file with -v and post the command line passed to the assembler?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (6 preceding siblings ...)
  2005-08-04  6:18 ` ebotcazou at gcc dot gnu dot org
@ 2005-08-04  6:25 ` aaron_williams at net dot com
  2005-08-04 13:14 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: aaron_williams at net dot com @ 2005-08-04  6:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aaron_williams at net dot com  2005-08-04 06:25 -------
Subject: Re:  gcc optimization error for sparc with xine/ffmpeg,
 bad assembly generated

Hmmm, I though I had binutils 2.16.1, but it's actually 2.15... that 
might be the problem.  Trying to upgrade to 2.16.1 now.

gcc -O3 -mcpu=ultrasparc -mtune=ultrasparc  -fno-inline-functions -c 
test.i -o test.o -v
Reading specs from /opt/gcc3.3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.6/specs
Configured with: ../configure --host=sparc-sun-solaris2.8 
--prefix=/opt/gcc3.3 --enable-shared --with-gnu-ld 
--with-ld=/opt/gcc3.3/bin/ld --with-gnu-as --with-as=/opt/gcc3.3/bin/as 
--with-cpu=ultrasparc
Thread model: posix
gcc version 3.3.6
 /opt/gcc3.3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.6/cc1 -fpreprocessed 
test.i -quiet -dumpbase test.i -mcpu=ultrasparc -mtune=ultrasparc 
-auxbase-strip test.o -O3 -version -fno-inline-functions -o 
/var/tmp//cczPFnhi.s
GNU C version 3.3.6 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.3.6.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 /opt/gcc3.3/bin/as -V -Qy -s -xarch=v8plusa -o test.o /var/tmp//cczPFnhi.s
GNU assembler version 2.15 (sparc-sun-solaris2.8) using BFD version 2.15
/var/tmp//cczPFnhi.s: Assembler messages:
/var/tmp//cczPFnhi.s:464: Error: Illegal operands: There are only 32 
single precision f registers; [0-31]

>
>  
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c/23222] gcc optimization error for sparc with xine/ffmpeg, bad assembly generated
  2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
                   ` (7 preceding siblings ...)
  2005-08-04  6:25 ` aaron_williams at net dot com
@ 2005-08-04 13:14 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04 13:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-04 13:14 -------
        fmovdne %fcc1, %f50, %f8


Yep this is still a dup of bug 15247.

*** This bug has been marked as a duplicate of 15247 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23222


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-08-04 13:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04  1:30 [Bug c/23222] New: gcc optimization error for sparc with xine/ffmpeg, bad assembly generated aaronw at net dot com
2005-08-04  1:33 ` [Bug c/23222] " aaronw at net dot com
2005-08-04  1:36 ` pinskia at gcc dot gnu dot org
2005-08-04  4:27 ` pinskia at gcc dot gnu dot org
2005-08-04  5:00 ` ebotcazou at gcc dot gnu dot org
2005-08-04  5:02 ` ebotcazou at gcc dot gnu dot org
2005-08-04  5:28 ` aaronw at attbi dot com
2005-08-04  6:18 ` ebotcazou at gcc dot gnu dot org
2005-08-04  6:25 ` aaron_williams at net dot com
2005-08-04 13:14 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).