public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/51793] New: pragma GCC optimize wrapv leads to invalid code on Solaris
@ 2012-01-08 13:19 bruno at clisp dot org
  2012-01-09 11:59 ` [Bug target/51793] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2012-01-08 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51793
           Summary: pragma GCC optimize wrapv leads to invalid code on
                    Solaris
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bruno@clisp.org


Created attachment 26274
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26274
Test case

The use of
#pragma GCC optimize ("wrapv")
with optimization level -O2 turns the ".p2align 4,,15" to ".p2align 4,,-1".
This can be observed on both i386-pc-solaris2.11 and i386-pc-linux-gnu systems.
On i386-pc-solaris2.11 it causes a compilation failure, because the assembler
does not understand this syntax.

How to reproduce:
================================== foo.c ==================================
#pragma GCC optimize ("wrapv")
int foo () { return 17; }
int bar () { return 42; }
===========================================================================


$ gcc -O2 -c foo.c
Assembler: foo.c
    "/var/tmp//ccwQaWQO.s", line 3 : .align test amount has negative value
    "/var/tmp//ccwQaWQO.s", line 10 : .align test amount has negative value

$ gcc -O2 -S foo.c

$ cat foo.s
    .file    "foo.c"
    .text
    .p2align 4,,-1
.globl foo
    .type    foo, @function
foo:
    movl    $17, %eax
    ret
    .size    foo, .-foo
    .p2align 4,,-1
.globl bar
    .type    bar, @function
bar:
    movl    $42, %eax
    ret
    .size    bar, .-bar
    .ident    "GCC: (GNU) 4.5.2"


$ gcc --version
gcc (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/lto-wrapper
Target: i386-pc-solaris2.11
Configured with:
/builds/hudson/workspace/nightly/build/i386/components/gcc45/gcc-4.5.2/configure
CC=/ws/onnv-tools/SUNWspro/sunstudio12.1/bin/cc
CXX=/ws/onnv-tools/SUNWspro/sunstudio12.1/bin/CC --prefix=/usr/gcc/4.5
--mandir=/usr/gcc/4.5/share/man --bindir=/usr/gcc/4.5/bin
--libdir=/usr/gcc/4.5/lib --sbindir=/usr/gcc/4.5/sbin
--enable-languages=c,c++,fortran,objc --enable-shared
--with-gmp-include=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr
--prefix=/usr/gcc/4.5 --mandir=/usr/gcc/4.5/share/man
--infodir=/usr/gcc/4.5/share/info --libexecdir=/usr/gcc/4.5/lib CFLAGS='-g -O2
'
Thread model: posix
gcc version 4.5.2 (GCC) 


$ type as
as is hashed (/usr/bin/as)

$ as -V
as: Sun Compiler Common 12 SunOS_i386 snv_174 08/25/2011
Usage: as [-V] [-Q{y,n}] [-s]
      [-S[aAbBcClL]] [-K {pic,PIC}] [-o objfile] [-L] [-T]
      [-P [[-Ipath] [-Dname] [-Dname=def] [-Uname]]...]
      [-m [-Ym,path]] [-n] [-xF] [-F] [-b] [-i] file.s ...


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

end of thread, other threads:[~2021-04-29  1:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08 13:19 [Bug target/51793] New: pragma GCC optimize wrapv leads to invalid code on Solaris bruno at clisp dot org
2012-01-09 11:59 ` [Bug target/51793] " rguenth at gcc dot gnu.org
2021-04-28 23:39 ` egallager at gcc dot gnu.org
2021-04-29  1:14 ` bruno at clisp dot org
2021-04-29  1:22 ` bruno at clisp dot 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).