Bug 28847 - as compiler error
Summary: as compiler error
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-25 19:08 UTC by Niklas Ulvinge
Modified: 2006-08-25 21:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niklas Ulvinge 2006-08-25 19:08:16 UTC
gcc: Internal error: Segmentation fault (program as)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-3.3/README.Bugs>.

This is waht gcc gives me when I compile with
clear; gcc asciiFractal3.c -masm=intel -o asciiFractal3 -O3 -save-temps

This is asciiFractal3.i:
# 1 "asciiFractal3.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "asciiFractal3.c"







char buffer[24*80 +1];
const float fhwid = 80/2,
            fhheg = 24/2,
            four = 4;
double zre,zim,cre,cim;
char *intens = " .;*|#|*;. ";
int x=80,y=24;

int main (void)
{
    asm(".intel_syntax noprefix\n"

        "\n finit"
    );


    asm(
        "\n mov eax, 0x41414141"
        "\n lea edi, buffer"
        "\n mov ecx, 80*24/2"
        "\n rep stosw"
        "\n "
        "\n "


        "\n lea edi, buffer"


        "\n xLoop:"

        "\n yLoop:"


        "\n xor ecx,ecx"


        "\n fild [y]"
        "\n fld  [fhheg]"
        "\n fdivp "
        "\n fld1"
        "\n faddp "
        "\n fadd st(0), st(0)"
        "\n fst [cim]"
        "\n fst [zim]"

        "\n fild [x]"
        "\n fld  [fhwid]"
        "\n fdivp "
        "\n fld1"
        "\n faddp "
        "\n fadd st(0), st(0)"
        "\n fst [cre]"
        "\n fst [zre]"
        "\n fld st(1)"
        "\n fld st(1)"
    );
    asm(





        "\n cLoop:"
        "\n fld st(1)"
        "\n fmul st(0),st(0)"
        "\n fld st(1)"
        "\n fmul st(0),st(0)"
        "\n faddp "
        "\n ficomp [four]"

        "\n fstsw ax"
        "\n fwait"
        "\n sahf"
        "\n ja cLoopEnd"

        "\n fld st(0)"
        "\n fmul st(0),st(2)"
        "\n fadd st(0),st(0)"
        "\n fadd st(0),st(4)"

        "\n fld st(1)"
        "\n fmul st(0),st(0)"
        "\n fld st(3)"
        "\n fmul st(0),st(0)"
        "\n fsubp st(1),st(0)"
        "\n fadd st(0),st(3)"







        "\n fstp st(2)"
        "\n fstp st(2)"

        "\n add ecx,1"

        "\n cmp ecx,10"
        "\n jb cLoop"
        "\n cLoopEnd:"

        "\n lea ebx,intens+ecx"
        "\n mov ah, [ebx]"
        "\n mov edx, [x]"
        "\n lea ebx, ebx+buffer"

        "\n cld"
        "\n stosb"
    );

    asm(
        "\n sub [y],1"
        "\n jnz yLoop"

        "\n sub [x],1"
        "\n jnz xLoop"
    );


    buffer[24*80] = 0;
    puts(buffer);

    return 0;
}




And this is gcc -v output:
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --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-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.4 (Debian 1:3.3.4-7)






I'm using DSL but don't know the version...
Comment 1 Niklas Ulvinge 2006-08-25 19:13:56 UTC
I fogot to mention, that the line that caused the bug is this line

        "\n lea ebx, ebx+buffer"
Comment 2 Andrew Pinski 2006-08-25 19:15:20 UTC
This is not a GCC issue really but a bug in as, yes we should not report to file a bug here but that is PR 2252.
Comment 3 Niklas Ulvinge 2006-08-25 19:27:03 UTC
OK, but what is PR 2252 ?

Nevermind, it was easy to fix...
just change
lea ebx, ebx+buffer
to
lea ebx, buffer+ebx

Simple, but it's still a bug.
I wont care.
Comment 4 Andrew Pinski 2006-08-25 21:09:49 UTC
(In reply to comment #3)
> OK, but what is PR 2252 ?

Try http://gcc.gnu.org/PR2252.

> Simple, but it's still a bug.

Yes but not a GCC one; it is a binutils bug.