[Bug c/91269] New: sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug c/91269] New: sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

            Bug ID: 91269
           Summary: sparc64-gcc fails to build glibc (-fcall-used-g6) on
                    niagara4: Assembler messages: Error: Illegal operands
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at inbox dot ru
  Target Milestone: ---

Original failure happens when glibc is built as:
    ../glibc/configure --prefix=/usr --build=x86_64-pc-linux-gnu
--host=sparc64-unknown-linux-gnu CFLAGS="-O2 -mcpu=niagara4 -pipe" && make
Single file iso-2022-jp-3.c fails to build as:
    sparc64-unknown-linux-gnu-gcc iso-2022-jp-3.c -c -std=gnu11 -fgnu89-inline
-O2 -mcpu=niagara4 -pipe -Wall -Wwrite-strings -Wundef -Werror
-fmerge-all-constants -frounding-math -fno-stack-protector -Wstrict-prototypes
-Wold-style-definition -fmath-errno -fcall-used-g6 -Wa,-Av9a -mvis  -fPIC    
-U_FORTIFY_SOURCE   -I../include
-I/home/slyfox/dev/git/glibc-build-sparc64/iconvdata
-I/home/slyfox/dev/git/glibc-build-sparc64
-I../sysdeps/unix/sysv/linux/sparc/sparc64
-I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/sparc
-I../sysdeps/sparc/nptl  -I../sysdeps/unix/sysv/linux/include
-I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread
-I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv
-I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/sparc/sparc64/fpu/multiarch
 -I../sysdeps/sparc/sparc64/fpu  -I../sysdeps/sparc/sparc64/multiarch
-I../sysdeps/sparc/sparc64  -I../sysdeps/wordsize-64
-I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64/wordsize-64
-I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
-I../sysdeps/sparc/fpu  -I../sysdeps/sparc  -I../sysdeps/ieee754
-I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include
/home/slyfox/dev/git/glibc-build-sparc64/libc-modules.h -DMODULE_NAME=iconvdata
-include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -o
/home/slyfox/dev/git/glibc-build-sparc64/iconvdata/iso-2022-jp-3.os -MD -MP -MF
/home/slyfox/dev/git/glibc-build-sparc64/iconvdata/iso-2022-jp-3.os.dt -MT
/home/slyfox/dev/git/glibc-build-sparc64/iconvdata/iso-2022-jp-3.os
{standard input}: Assembler messages:
{standard input}:2619: Error: Illegal operands

Attached self-contained reproducer fails in a similar way:

OK:
$ sparc64-unknown-linux-gnu-gcc -O2 -fno-stack-protector -fcall-used-g6
-mcpu=niagara3 -c bug.c -o bug.o
bug.c: In function 'c':
bug.c:13:8: warning: assignment to 'char *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
   13 |     cp = b[k];
      |        ^

Bad:
$ sparc64-unknown-linux-gnu-gcc -O2 -fno-stack-protector -fcall-used-g6
-mcpu=niagara4 -c bug.c -o bug.o
bug.c: In function 'c':
bug.c:13:8: warning: assignment to 'char *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
   13 |     cp = b[k];
      |        ^
/tmp/ccohisfz.s: Assembler messages:
/tmp/ccohisfz.s:145: Error: Illegal operands

$ sparc64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/sparc64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/sparc64-unknown-linux-gnu/9.1.0/lto-wrapper
Target: sparc64-unknown-linux-gnu
Configured with:
/tmp/portage-tmpdir/portage/cross-sparc64-unknown-linux-gnu/gcc-9.1.0-r1/work/gcc-9.1.0/configure
--host=x86_64-pc-linux-gnu --target=sparc64-unknown-linux-gnu
--build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/sparc64-unknown-linux-gnu/gcc-bin/9.1.0
--includedir=/usr/lib/gcc/sparc64-unknown-linux-gnu/9.1.0/include
--datadir=/usr/share/gcc-data/sparc64-unknown-linux-gnu/9.1.0
--mandir=/usr/share/gcc-data/sparc64-unknown-linux-gnu/9.1.0/man
--infodir=/usr/share/gcc-data/sparc64-unknown-linux-gnu/9.1.0/info
--with-gxx-include-dir=/usr/lib/gcc/sparc64-unknown-linux-gnu/9.1.0/include/g++-v9
--with-python-dir=/share/gcc-data/sparc64-unknown-linux-gnu/9.1.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 9.1.0-r1 p1.1' --disable-esp --enable-libstdcxx-time
--with-build-config=bootstrap-lto --enable-poison-system-directories
--with-sysroot=/usr/sparc64-unknown-linux-gnu --disable-bootstrap
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-altivec
--disable-fixed-point --enable-targets=all --enable-libgomp
--disable-libmudflap --disable-libssp --disable-systemtap
--enable-vtable-verify --enable-lto --without-isl --enable-default-pie
--enable-default-ssp
Thread model: posix
gcc version 9.1.0 (Gentoo 9.1.0-r1 p1.1)
Reply | Threaded
Open this post in threaded view
|

[Bug c/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #1 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Created attachment 46630
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46630&action=edit
bug.c
Reply | Threaded
Open this post in threaded view
|

[Bug c/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
$ sparc64-unknown-linux-gnu-gcc -O2 -fno-stack-protector -fcall-used-g6
-mcpu=niagara4 -c bug.c -o bug.o

bug.c: In function 'c':
bug.c:13:8: warning: assignment to 'char *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
   13 |     cp = b[k];
      |        ^
/tmp/cc0K0Ide.s: Assembler messages:
/tmp/cc0K0Ide.s:145: Error: Illegal operands
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #3 from Sergei Trofimovich <slyfox at inbox dot ru> ---
$ sparc64-unknown-linux-gnu-gcc -S -O2 -fno-stack-protector -fcall-used-g6
-mcpu=niagara4 -c bug.c -o bug.S
bug.c: In function 'c':
bug.c:13:8: warning: assignment to 'char *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
   13 |     cp = b[k];
      |        ^

$ sparc64-unknown-linux-gnu-gcc -c -O2 -fno-stack-protector -fcall-used-g6
-mcpu=niagara4 -c bug.S -o bug.o
bug.c: Assembler messages:
bug.c:145: Error: Illegal operands

$ nl -bt bug.S | grep -C3 145
   142          cwbe    %g0, %g0, .L5
   143  .L40:
   144          mov     %i0, %o0
   145          std     %f9, [%fp+1999]
   146          stx     %g4, [%fp+2007]
   147          stx     %o2, [%fp+2015]
   148          call    u, 0

Commenting out line '145          std     %f9, [%fp+1999]' does not make error
disappear. Line numbers are probably skewed.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #4 from Sergei Trofimovich <slyfox at inbox dot ru> ---
> Commenting out line '145          std     %f9, [%fp+1999]' does not make
> error disappear. Line numbers are probably skewed.

Oh, it's because I used ';' as a comment. Commenting out with '#' makes the
error go away.

Perhaps 1999 is too large an offset for 'std'.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

Matt Turner <mattst88 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mattst88 at gmail dot com

--- Comment #5 from Matt Turner <mattst88 at gmail dot com> ---
With -mcpu=niagara4 and *without* -fcall-used-g6 it compiles fine.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #6 from Matt Turner <mattst88 at gmail dot com> ---
(In reply to Matt Turner from comment #5)
> With -mcpu=niagara4 and *without* -fcall-used-g6 it compiles fine.

Also doesn't occur with -O1 or -mno-lra.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #7 from Matt Turner <mattst88 at gmail dot com> ---
(In reply to Sergei Trofimovich from comment #4)
> > Commenting out line '145          std     %f9, [%fp+1999]' does not make
> > error disappear. Line numbers are probably skewed.
>
> Perhaps 1999 is too large an offset for 'std'.

Sergei noticed that 'std' must take an even numbered register, so s/f9/f8/ on
that line causes it to assemble.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #8 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Extra info: -fPIE is also needed to reproduce on on vanilla gcc from git.
Thus the reproducer is:

  $ gcc/xgcc -Bgcc -O2 -fcall-used-g6 -fPIE -mcpu=niagara4 -c bug.c -o bug.o

bug.c: In function 'c':
bug.c:13:8: warning: assignment to 'char *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
   13 |     cp = b[k];
      |        ^
/tmp/ccaJlRBg.s: Assembler messages:
/tmp/ccaJlRBg.s:145: Error: Illegal operands



  $ gcc/xgcc -Bgcc -v

Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: sparc64-unknown-linux-gnu
Configured with: ../gcc/configure --target=sparc64-unknown-linux-gnu
--with-sysroot=/usr/sparc64-unknown-linux-gnu --enable-languages=c
--disable-bootstrap
--prefix=/home/slyfox/dev/git/gcc-sparc64/../gcc-sparc64-installed
--disable-multilib cross_compiling=yes
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.0 20190728 (experimental) (GCC)
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] sparc64-gcc fails to build glibc (-fcall-used-g6) on niagara4: Assembler messages: Error: Illegal operands

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #9 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Still happens on
    gcc version 10.0.0 20190916 (experimental) (GCC)
How can I peek at the stage where registers are assigned to std instruction? I
suspect it needs special annotation WRT paired FPU registers.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-09-17
                 CC|                            |ebotcazou at gcc dot gnu.org
      Known to work|                            |7.4.0, 8.3.0
   Target Milestone|---                         |9.3
            Summary|sparc64-gcc fails to build  |[9/10 regression] unaligned
                   |glibc (-fcall-used-g6) on   |floating-point register
                   |niagara4: Assembler         |with -mcpu=niagara4
                   |messages: Error: Illegal    |-fcall-used-g6
                   |operands                    |
     Ever confirmed|0                           |1
      Known to fail|                            |10.0, 9.1.0, 9.2.0

--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I can reproduce.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #11 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Investigating.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #12 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Author: ebotcazou
Date: Fri Sep 20 09:42:40 2019
New Revision: 275994

URL: https://gcc.gnu.org/viewcvs?rev=275994&root=gcc&view=rev
Log:
        PR target/91269
        * config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Define.

Added:
    trunk/gcc/testsuite/gcc.dg/pr91269.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sparc/sparc.h
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #13 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Author: ebotcazou
Date: Fri Sep 20 09:45:26 2019
New Revision: 275995

URL: https://gcc.gnu.org/viewcvs?rev=275995&root=gcc&view=rev
Log:
        PR target/91269
        * config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Define.

Added:
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/pr91269.c
      - copied unchanged from r275994, trunk/gcc/testsuite/gcc.dg/pr91269.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/sparc/sparc.h
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #14 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This should compile again.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #15 from Matt Turner <mattst88 at gmail dot com> ---
I believe the Known to work field is wrong and gcc-8.3.0 has this bug as well.
Can we have this backported to the gcc-8 branch?

Thank you!

(FWIW, we also discovered that lz4-1.8.3 fails to build on 64-bit sparc due to
tihs bug as well)
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #16 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I believe the Known to work field is wrong and gcc-8.3.0 has this bug as
> well.

No, the field is correct and you're wrong.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #17 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Created attachment 46906
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46906&action=edit
bug-lz4-8.3.0.c

Here is a bug-lz4-8.3.0.c that exposes suspiciously similar failure on sparc64
gcc-8.3.0 on lz4-1.8.3 package:

  $ LANG=C sparc64-unknown-linux-gnu-gcc-8.3.0 -O2 -pipe -mcpu=niagara4 -fPIC
-c bug-lz4-8.3.0.c -o bug-lz4-8.3.0.o

  {standard input}: Assembler messages:
  {standard input}:365: Error: Illegal operands
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #18 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Here is a bug-lz4-8.3.0.c that exposes suspiciously similar failure on
> sparc64 gcc-8.3.0 on lz4-1.8.3 package:

Please open a new PR with the appropriate information, this one is closed.
Reply | Threaded
Open this post in threaded view
|

[Bug target/91269] [9/10 regression] unaligned floating-point register with -mcpu=niagara4 -fcall-used-g6

rguenth at gcc dot gnu.org
In reply to this post by rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91269

--- Comment #19 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Eric Botcazou from comment #18)
> > Here is a bug-lz4-8.3.0.c that exposes suspiciously similar failure on
> > sparc64 gcc-8.3.0 on lz4-1.8.3 package:
>
> Please open a new PR with the appropriate information, this one is closed.

Sounds good. Filed bug #91854.
12