public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bruno at clisp dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/51793] New: pragma GCC optimize wrapv leads to invalid code on Solaris
Date: Sun, 08 Jan 2012 13:19:00 -0000	[thread overview]
Message-ID: <bug-51793-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-01-08 13:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 13:19 bruno at clisp dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51793-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).