https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65644

            Bug ID: 65644
           Summary: Assembler errors on Solaris 10 x86-64: `(%eXX)' is not
                    a valid 64 bit base/index expression
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skunk at iskunk dot org
              Host: x86_64-pc-solaris2.10
            Target: x86_64-pc-solaris2.10
             Build: x86_64-pc-solaris2.10

Created attachment 35197
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35197&action=edit
test case

I built GCC 4.9.2 on a Solaris 10 system on x86-64, and then compiled a C
codebase that does some 64-bit-unsafe things (notably, assuming that pointers
are 32 bits, by casting unsigned ints to pointers). This resulted in "cast to
pointer from integer of different size" warnings as well as errors of the form

    {standard input}: Assembler messages:
    {standard input}:233: Error: `(%esi)' is not a valid 64 bit base/index
expression
    {standard input}:250: Error: `(%edx)' is not a valid 64 bit base/index
expression
    {standard input}:1150: Error: `(%edx)' is not a valid 64 bit base/index
expression

I have prepared a small test case that exhibits this same failure mode:

    $ gcc -m64 -O -c gcc-asm-bug.c
    gcc-asm-bug.c: In function 'foo1':
    gcc-asm-bug.c:14:4: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
       ((struct foo_struct *)xptr)->one = val;
        ^
    gcc-asm-bug.c: In function 'foo2':
    gcc-asm-bug.c:19:4: warning: cast to pointer from integer of different size
[-Wint-to-pointer-cast]
       ((struct foo_struct *)xptr)->two = val;
        ^
    /var/tmp//ccI3ovqk.s: Assembler messages:
    /var/tmp//ccI3ovqk.s:6: Error: `(%edi)' is not a valid 64 bit base/index
expression

No such error occurs when I compile this source on a Linux system, so this may
have to do with the Solaris assembler.

Reply via email to