public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu
@ 2015-04-01 11:44 dhowells at redhat dot com
  2015-04-01 11:48 ` [Bug target/65649] " dhowells at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dhowells at redhat dot com @ 2015-04-01 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65649
           Summary: gcc generates overlarge constants for
                    microblaze-linux-gnu
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dhowells at redhat dot com

Whilst compiling libgcc for microblaze-linux-gnu, gcc produces overlarge
constants that don't fit into a 32-bits (microblaze is a 32-bit arch), eg:

    addik    r23,r0,0xb746a0003f800000

the assembler complains about these:

    _powisf2.s:71: Fatal error: operand must be a constant or a label

if it is hosted on a 32-bit arch (eg. i386) but not if it's hosted on a 64-bit
arch (eg. x86_64).  This is logged here:

    https://sourceware.org/bugzilla/show_bug.cgi?id=18189

However, gcc shouldn't be producing these at all.

Reducing the preprocessed C to the bare function gives:

    float __powisf2 (float x, int m)
    {
      unsigned int n = m < 0 ? -m : m;
      float y = n % 2 ? x : 1;
      while (n >>= 1)
    {
      x = x * x;
      if (n % 2)
        y = y * x;
    }
      return m < 0 ? 1/y : y;
    }

Reducing it still further to:

    float __powisf2 (float x, int m)
    {
      unsigned int n = m < 0 ? -m : m;
      float y = n % 2 ? x : 1;
      return y;
    }

gives the error _only_ if -g is supplied.  Looking at the assembly output of
this, the dodgy instruction is now:

        addik   r3,r0,0xb745e0003f800000

with -g and:

        addik   r3,r0,0x3f800000

without.

The compilation line is:

/root/cross-gcc/gcc-5.0.0-20150319/microblaze-linux-gnu/gcc/xgcc
-B/root/cross-gcc/gcc-5.0.0-20150319/microblaze-linux-gnu/gcc/
-B/usr/microblaze-linux-gnu/bin/ -B/usr/microblaze-linux-gnu/lib/ -O2 -fPIC
-fbuilding-libgcc -fno-exceptions -fno-stack-protector -fvisibility=hidden -o
_powisf2.o -c _powisf2.i --save-temps -g


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
@ 2015-04-01 11:48 ` dhowells at redhat dot com
  2015-04-01 11:55 ` dhowells at redhat dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dhowells at redhat dot com @ 2015-04-01 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from dhowells at redhat dot com <dhowells at redhat dot com> ---
Created attachment 35201
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35201&action=edit
Assembler output from larger reduced case

Here is the assembler output from the larger reduced case.  The dodgy constant
occurs on line 71 and also on line 124.


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
  2015-04-01 11:48 ` [Bug target/65649] " dhowells at redhat dot com
@ 2015-04-01 11:55 ` dhowells at redhat dot com
  2015-04-21  8:30 ` nickc at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dhowells at redhat dot com @ 2015-04-01 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from dhowells at redhat dot com <dhowells at redhat dot com> ---
gcc was based on the gcc-5.0.0-20150319 tarball generated from the gcc branch
redhat/gcc-5-branch plus the patches for the Fedora rawhide gcc and cross-gcc.

Configuration was:

CC=gcc \
CXX=g++ \
CFLAGS='-O2 -g -Wall -Wformat-security -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=atom
-fasynchronous-unwind-tables' \
CXXFLAGS=' -O2 -g -Wformat-security -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=atom
-fasynchronous-unwind-tables ' \
CFLAGS_FOR_TARGET='-g -O2 -Wall -fno-exceptions' \
AR_FOR_TARGET=/usr/bin/microblaze-linux-gnu-ar \
AS_FOR_TARGET=/usr/bin/microblaze-linux-gnu-as \
DLLTOOL_FOR_TARGET=/usr/bin/microblaze-linux-gnu-dlltool \
LD_FOR_TARGET=/usr/bin/microblaze-linux-gnu-ld \
NM_FOR_TARGET=/usr/bin/microblaze-linux-gnu-nm \
OBJDUMP_FOR_TARGET=/usr/bin/microblaze-linux-gnu-objdump \
RANLIB_FOR_TARGET=/usr/bin/microblaze-linux-gnu-ranlib \
READELF_FOR_TARGET=/usr/bin/microblaze-linux-gnu-readelf \
STRIP_FOR_TARGET=/usr/bin/microblaze-linux-gnu-strip \
WINDRES_FOR_TARGET=/usr/bin/microblaze-linux-gnu-windres \
WINDMC_FOR_TARGET=/usr/bin/microblaze-linux-gnu-windmc \
LDFLAGS='-Wl,-z,relro ' \
../gcc-5.0.0-20150319/configure --bindir=/usr/bin --build=i686-redhat-linux-gnu
--datadir=/usr/share --disable-decimal-float --disable-dependency-tracking
--disable-gold --disable-libgcj --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libssp --disable-libunwind-exceptions
--disable-nls --disable-plugin --disable-shared --disable-silent-rules
--disable-sjlj-exceptions --disable-threads
--with-ld=/usr/bin/microblaze-linux-gnu-ld --enable-__cxa_atexit
--enable-checking=release --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-initfini-array --enable-languages=c,c++
--enable-linker-build-id --enable-nls --enable-obsolete --enable-plugin
--enable-targets=all --exec-prefix=/usr --host=i686-redhat-linux-gnu
--includedir=/usr/include --infodir=/usr/share/info --libexecdir=/usr/libexec
--localstatedir=/var --mandir=/usr/share/man --prefix=/usr
--program-prefix=microblaze-linux-gnu- --sbindir=/usr/sbin
--sharedstatedir=/var/lib --sysconfdir=/etc --target=microblaze-linux-gnu
--with-bugurl=http://bugzilla.redhat.com/bugzilla/ --with-isl
--with-linker-hash-style=gnu --with-newlib
--with-sysroot=/usr/microblaze-linux-gnu/sys-root --with-system-libunwind
--with-system-zlib --without-headers

And the build:

make -C microblaze-linux-gnu -j16 tooldir=/usr all-gcc
make -C microblaze-linux-gnu -j16 tooldir=/usr all-target-libgcc

The microblaze binutils was binutils-2.25 plus the Fedora F21 patches from the
cross-binutils targetted at microblaze-linux-gnu.


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
  2015-04-01 11:48 ` [Bug target/65649] " dhowells at redhat dot com
  2015-04-01 11:55 ` dhowells at redhat dot com
@ 2015-04-21  8:30 ` nickc at redhat dot com
  2015-04-21 11:21 ` nickc at redhat dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nickc at redhat dot com @ 2015-04-21  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #3 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 35373
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35373&action=edit
Use %lx/%ld to print long types

Hi Guys,

  Here is a patch to fix this problem.  The bug is that in a couple of places
the microblaze backend is using %llx to print out the value of a long type.  On
a 64-bit host this does not matter, but compiling on a 32-bit host the result
is extra garbage digits in the output.

Cheers
  Nick


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (2 preceding siblings ...)
  2015-04-21  8:30 ` nickc at redhat dot com
@ 2015-04-21 11:21 ` nickc at redhat dot com
  2015-04-21 15:28 ` nickc at redhat dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nickc at redhat dot com @ 2015-04-21 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 35376
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35376&action=edit
Patch resend

Darn - apparently the previous version of this patch suffered from TAB/space
corruption.  So here is a resend of the patch


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (3 preceding siblings ...)
  2015-04-21 11:21 ` nickc at redhat dot com
@ 2015-04-21 15:28 ` nickc at redhat dot com
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nickc at redhat dot com @ 2015-04-21 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 35379
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35379&action=edit
this time with a %0xlx....

Hi Guys,

  *sigh* this has not been my day.  The previous two patches both had a small
thinko in them - I was printing a hex value into the assembler file without a
preceeding 0x prefix...  Doh.  So, a third attempt at the patch is attached.

Cheers
  Nick


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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (4 preceding siblings ...)
  2015-04-21 15:28 ` nickc at redhat dot com
@ 2020-05-07 11:56 ` jakub at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.0                        |10.2

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.1 has been released.

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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (5 preceding siblings ...)
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (6 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2022-06-28 10:31 ` jakub at gcc dot gnu.org
  2023-07-07  7:27 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (7 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2022-06-28 10:31 ` jakub at gcc dot gnu.org
  2023-07-07  7:27 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug target/65649] gcc generates overlarge constants for microblaze-linux-gnu
  2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
                   ` (8 preceding siblings ...)
  2022-06-28 10:31 ` jakub at gcc dot gnu.org
@ 2023-07-07  7:27 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |---

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

end of thread, other threads:[~2023-07-07  7:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 11:44 [Bug target/65649] New: gcc generates overlarge constants for microblaze-linux-gnu dhowells at redhat dot com
2015-04-01 11:48 ` [Bug target/65649] " dhowells at redhat dot com
2015-04-01 11:55 ` dhowells at redhat dot com
2015-04-21  8:30 ` nickc at redhat dot com
2015-04-21 11:21 ` nickc at redhat dot com
2015-04-21 15:28 ` nickc at redhat dot com
2020-05-07 11:56 ` jakub at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
2023-07-07  7:27 ` rguenth at gcc dot gnu.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).