public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
@ 2013-04-09  8:36 rainer.jung at kippdata dot de
  2013-04-09  8:38 ` [Bug c/56890] " rainer.jung at kippdata dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rainer.jung at kippdata dot de @ 2013-04-09  8:36 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56890
           Summary: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rainer.jung@kippdata.de


Created attachment 29835
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29835
Minimal test case (only for -O2)

gcc 4.7.2

config.nice:

Will attach minimal C test case and assembler file.
GCC flags: gcc -m64 -O2

Error message:

/usr/ccs/bin/as: "test.s", line 29: error: invalid (misaligned) register

Problematic assembler line:

        fdtox   %f8, %f9

Sun assembler version:

/usr/ccs/bin/as: SunOS 5.10 118683-08 Patch 07/05/2012

It seems the second argument needs an even register number.

Another reporter also ran into the problem with GCC 4.6.3, but this works here,
so maybe a problem with one of the helper libraries mpc, gmp, mpfr?

Bug also reported for FreeBSD/sparc64.

A slightly bigger test case closer to the original code (also attached) also
gives an error when compiling only with "-O" or "-O1" instead of "-O2":

test.c: In function 'buggy':
test.c:13:1: error: insn does not satisfy its constraints:
(insn 103 38 39 3 (set (reg:HI 40 %f8 [151])
        (reg:HI 42 %f10)) test.c:6 58 {*movhi_insn}
     (nil))
test.c:13:1: internal compiler error: in reload_cse_simplify_operands, at
postreload.c:403
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Original bug report was against the Apache Web Server:
https://issues.apache.org/bugzilla/show_bug.cgi?id=52900

Regards,

Rainer


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

* [Bug c/56890] Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
@ 2013-04-09  8:38 ` rainer.jung at kippdata dot de
  2013-04-09  8:40 ` rainer.jung at kippdata dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rainer.jung at kippdata dot de @ 2013-04-09  8:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Rainer Jung <rainer.jung at kippdata dot de> 2013-04-09 08:38:02 UTC ---
Created attachment 29836
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29836
Slightly bigger test case with additional error for -O1


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

* [Bug c/56890] Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
  2013-04-09  8:38 ` [Bug c/56890] " rainer.jung at kippdata dot de
@ 2013-04-09  8:40 ` rainer.jung at kippdata dot de
  2013-04-09  8:55 ` [Bug target/56890] " rainer.jung at kippdata dot de
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rainer.jung at kippdata dot de @ 2013-04-09  8:40 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Rainer Jung <rainer.jung at kippdata dot de> 2013-04-09 08:40:40 UTC ---
Created attachment 29837
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29837
Assembler file, problem in line 29 (fdtox   %f8, %f9)


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

* [Bug target/56890] Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
  2013-04-09  8:38 ` [Bug c/56890] " rainer.jung at kippdata dot de
  2013-04-09  8:40 ` rainer.jung at kippdata dot de
@ 2013-04-09  8:55 ` rainer.jung at kippdata dot de
  2013-04-09 16:09 ` ebotcazou at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rainer.jung at kippdata dot de @ 2013-04-09  8:55 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Rainer Jung <rainer.jung at kippdata dot de> 2013-04-09 08:55:25 UTC ---
Forgot to post my configure line for gcc:

../gcc-4.7.2/configure
--prefix=/opt/build/tools/gcc-4.7.2
--with-local-prefix=/opt/build/tools/gcc-4.7.2
--with-mpfr=/opt/build/tools
--with-gmp=/opt/build/tools
--with-mpc=/opt/build/tools
--with-ppl=/opt/build/tools
--with-cloog=/opt/build/tools
--with-libiconv-prefix=/opt/build/tools
--with-libintl-prefix=/opt/build/tools
--enable-languages=c,c++,fortran,go,objc
--enable-lto


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

* [Bug target/56890] Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (2 preceding siblings ...)
  2013-04-09  8:55 ` [Bug target/56890] " rainer.jung at kippdata dot de
@ 2013-04-09 16:09 ` ebotcazou at gcc dot gnu.org
  2013-04-11  9:21 ` [Bug target/56890] invalid fdtox instruction in 64-bit mode " windward at gmx dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-04-09 16:09 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-09
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org
     Ever Confirmed|0                           |1

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-09 16:09:06 UTC ---
Confirmed, thanks for the reduced testcases.


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

* [Bug target/56890] invalid fdtox instruction in 64-bit mode with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (3 preceding siblings ...)
  2013-04-09 16:09 ` ebotcazou at gcc dot gnu.org
@ 2013-04-11  9:21 ` windward at gmx dot com
  2013-04-15  8:35 ` ebotcazou at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: windward at gmx dot com @ 2013-04-11  9:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Martin <windward at gmx dot com> 2013-04-11 09:21:54 UTC ---
Created attachment 29854
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29854
Results of testcase with -O0 to -O3 for gcc 4.7.2 and 4.8.0

Output (stdout+stderr, assembler file) of Rainer's bigger testcase.

Ran a short testcase with gcc 4.7.2 and 4.8.0, each called with -O0 to -O3.
Other parameters were -m64 -save-temps -Wall -Wextra -fno-strict-aliasing
-fwrapv. Assembler was GNU assembler (GNU Binutils) 2.23.1. More details
available if needed.

gcc 4.8.0 compiles fine except for a warning:

test.c: In function 'buggy':
test.c:6:67: warning: 'num16' may be used uninitialized in this function
[-Wmaybe-uninitialized]
         num16 = min + (long) ((double) (max - min + 1.0) * (num16 / (65535 +
1.0)));
                                                                   ^
test.c:10:71: warning: 'number' may be used uninitialized in this function
[-Wmaybe-uninitialized]
         (number) = min + (long) ((double) (max - min + 1.0) * (number /
(4294967295U + 1.0)));
                                                                       ^
gcc 4.7.2 fails for anything but -O0:

::::::::::::::
gcc472_O0_out
::::::::::::::
test.c: In function 'buggy':
test.c:6:67: warning: 'num16' may be used uninitialized in this function
[-Wuninitialized]
test.c:10:71: warning: 'number' may be used uninitialized in this function
[-Wuninitialized]
::::::::::::::
gcc472_O1_out
::::::::::::::
test.c: In function 'buggy':
test.c:6:67: warning: 'num16' may be used uninitialized in this function
[-Wuninitialized]
test.c:10:71: warning: 'number' may be used uninitialized in this function
[-Wuninitialized]
test.c:13:1: error: insn does not satisfy its constraints:
(insn 127 42 43 3 (set (reg:HI 40 %f8 [162])
        (reg:HI 42 %f10)) test.c:6 58 {*movhi_insn}
     (nil))
test.c:13:1: internal compiler error: in reload_cse_simplify_operands, at
postreload.c:403
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
::::::::::::::
gcc472_O2_out
::::::::::::::
test.c: In function 'buggy':
test.c:6:67: warning: 'num16' may be used uninitialized in this function
[-Wuninitialized]
test.c:10:71: warning: 'number' may be used uninitialized in this function
[-Wuninitialized]
test.s: Assembler messages:
test.s:35: Error: Illegal operands
::::::::::::::
gcc472_O3_out
::::::::::::::
test.c: In function 'buggy':
test.c:6:67: warning: 'num16' may be used uninitialized in this function
[-Wuninitialized]
test.c:10:71: warning: 'number' may be used uninitialized in this function
[-Wuninitialized]
test.s: Assembler messages:
test.s:35: Error: Illegal operands

Hope that helps.

Cheers,

Martin


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

* [Bug target/56890] invalid fdtox instruction in 64-bit mode with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (4 preceding siblings ...)
  2013-04-11  9:21 ` [Bug target/56890] invalid fdtox instruction in 64-bit mode " windward at gmx dot com
@ 2013-04-15  8:35 ` ebotcazou at gcc dot gnu.org
  2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-04-15  8:35 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-15 08:35:50 UTC ---
Author: ebotcazou
Date: Mon Apr 15 08:28:41 2013
New Revision: 197958

URL: http://gcc.gnu.org/viewcvs?rev=197958&root=gcc&view=rev
Log:
    PR target/56890
    * config/sparc/sparc.c (enum sparc_mode_class): Add H_MODE value.
    (S_MODES): Set H_MODE bit.
    (SF_MODES): Set only S_MODE and SF_MODE bits.
    (DF_MODES): Set SF_MODES and only D_MODE and DF_MODE bits.
    (sparc_init_modes) <MODE_INT>: Set H_MODE bit for sub-word modes.
    <MODE_VECTOR_INT>: Do not set SF_MODE for sub-word modes.
    <MODE_FLOAT>: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/pr56890-1.c
    trunk/gcc/testsuite/gcc.dg/pr56890-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sparc/sparc.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/56890] invalid fdtox instruction in 64-bit mode with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (5 preceding siblings ...)
  2013-04-15  8:35 ` ebotcazou at gcc dot gnu.org
@ 2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
  2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
  2013-04-15 15:34 ` rainer.jung at kippdata dot de
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-04-15  8:36 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-15 08:36:16 UTC ---
Author: ebotcazou
Date: Mon Apr 15 08:31:12 2013
New Revision: 197959

URL: http://gcc.gnu.org/viewcvs?rev=197959&root=gcc&view=rev
Log:
    PR target/56890
    * config/sparc/sparc.c (enum sparc_mode_class): Add H_MODE value.
    (S_MODES): Set H_MODE bit.
    (SF_MODES): Set only S_MODE and SF_MODE bits.
    (DF_MODES): Set SF_MODES and only D_MODE and DF_MODE bits.
    (sparc_init_modes) <MODE_INT>: Set H_MODE bit for sub-word modes.
    <MODE_VECTOR_INT>: Do not set SF_MODE for sub-word modes.
    <MODE_FLOAT>: Likewise.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr56890-1.c
      - copied unchanged from r197958, trunk/gcc/testsuite/gcc.dg/pr56890-1.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr56890-2.c
      - copied unchanged from r197958, trunk/gcc/testsuite/gcc.dg/pr56890-2.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/sparc/sparc.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug target/56890] invalid fdtox instruction in 64-bit mode with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (6 preceding siblings ...)
  2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
@ 2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
  2013-04-15 15:34 ` rainer.jung at kippdata dot de
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-04-15  8:36 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-15 08:36:36 UTC ---
Author: ebotcazou
Date: Mon Apr 15 08:33:56 2013
New Revision: 197960

URL: http://gcc.gnu.org/viewcvs?rev=197960&root=gcc&view=rev
Log:
    PR target/56890
    * config/sparc/sparc.c (enum sparc_mode_class): Add H_MODE value.
    (S_MODES): Set H_MODE bit.
    (SF_MODES): Set only S_MODE and SF_MODE bits.
    (DF_MODES): Set SF_MODES and only D_MODE and DF_MODE bits.
    (sparc_init_modes) <MODE_INT>: Set H_MODE bit for sub-word modes.
    <MODE_VECTOR_INT>: Do not set SF_MODE for sub-word modes.
    <MODE_FLOAT>: Likewise.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr56890-1.c
      - copied unchanged from r197959, trunk/gcc/testsuite/gcc.dg/pr56890-1.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr56890-2.c
      - copied unchanged from r197959, trunk/gcc/testsuite/gcc.dg/pr56890-2.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/sparc/sparc.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug target/56890] invalid fdtox instruction in 64-bit mode with -O2
  2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
                   ` (7 preceding siblings ...)
  2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
@ 2013-04-15 15:34 ` rainer.jung at kippdata dot de
  8 siblings, 0 replies; 10+ messages in thread
From: rainer.jung at kippdata dot de @ 2013-04-15 15:34 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #12 from Rainer Jung <rainer.jung at kippdata dot de> 2013-04-15 15:34:42 UTC ---
I tried the sparc.c patch on top of GCC 4.7.3 and it works.

Thanks for fixing :)


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

end of thread, other threads:[~2013-04-15 15:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-09  8:36 [Bug c/56890] New: Invalid fdtox %f8, %f9 on Sparc 64 Bits with -O2 rainer.jung at kippdata dot de
2013-04-09  8:38 ` [Bug c/56890] " rainer.jung at kippdata dot de
2013-04-09  8:40 ` rainer.jung at kippdata dot de
2013-04-09  8:55 ` [Bug target/56890] " rainer.jung at kippdata dot de
2013-04-09 16:09 ` ebotcazou at gcc dot gnu.org
2013-04-11  9:21 ` [Bug target/56890] invalid fdtox instruction in 64-bit mode " windward at gmx dot com
2013-04-15  8:35 ` ebotcazou at gcc dot gnu.org
2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
2013-04-15  8:36 ` ebotcazou at gcc dot gnu.org
2013-04-15 15:34 ` rainer.jung at kippdata dot de

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).