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
* [Bug target/51793] pragma GCC optimize wrapv leads to invalid code on Solaris
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 ` rguenth at gcc dot gnu.org
2021-04-28 23:39 ` egallager at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-09 11:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|i386-pc-solaris2.11 |x86_64-*-*, i?86-*-*
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-09
Host|i386-pc-solaris2.11 |
Ever Confirmed|0 |1
Build|i386-pc-solaris2.11 |
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-09 11:59:09 UTC ---
Huh, weird. Works with GCC 4.3 (which does not implement the pragma).
Confirmed. At least generic x86 is affected.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/51793] pragma GCC optimize wrapv leads to invalid code on Solaris
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
3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-04-28 23:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
I've seen this bug referenced in some versions of gnulib's mktime.c; is it
still relevant?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/51793] pragma GCC optimize wrapv leads to invalid code on Solaris
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
3 siblings, 0 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2021-04-29 1:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793
Bruno Haible <bruno at clisp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to fail| |4.5.4, 4.6.4, 4.7.3, 4.8.5,
| |4.9.4
Known to work| |10.3.0, 11.1.0, 5.5.0,
| |6.5.0, 7.5.0, 8.4.0, 9.3.0
Resolution|--- |FIXED
--- Comment #3 from Bruno Haible <bruno at clisp dot org> ---
It works fine on
- Solaris 11.4 (gcc 7.3.0): foo.s contains '.p2align 4,,15'
- Solaris 11 OpenIndiana (gcc 7.2.0): likewise
- Solaris 11 OmniOS (gcc 9.3.0): foo.s does not contain .p2align directives any
more
More details by testing various versions on i386-pc-linux-gnu:
4.5.4 -> .p2align 4,,-1
4.6.4 -> .p2align 4,,-1
4.7.3 -> .p2align 4,,-1
4.8.5 -> .p2align 4,,-1
4.9.4 -> .p2align 4,,-1
5.5.0 -> no .p2align any more
6.5.0 -> .p2align 4,,15
7.5.0 -> .p2align 4,,15
8.4.0 -> .p2align 4,,15
9.3.0 -> .p2align 4
10.3.0 -> .p2align 4
11.1.0 -> .p2align 4
In summary, it appears to be fixed since GCC version 5.x.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/51793] pragma GCC optimize wrapv leads to invalid code on Solaris
2012-01-08 13:19 [Bug target/51793] New: pragma GCC optimize wrapv leads to invalid code on Solaris bruno at clisp dot org
` (2 preceding siblings ...)
2021-04-29 1:14 ` bruno at clisp dot org
@ 2021-04-29 1:22 ` bruno at clisp dot org
3 siblings, 0 replies; 5+ messages in thread
From: bruno at clisp dot org @ 2021-04-29 1:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793
--- Comment #4 from Bruno Haible <bruno at clisp dot org> ---
Correction to comment #3:
It works fine on
- Solaris 11.4 (gcc 7.3.0): foo.s contains '.p2align 4,,15'
- Solaris 11 OpenIndiana (gcc 7.2.0): likewise
- Solaris 11 OmniOS (gcc 9.3.0): foo.s contains '.p2align 4'
Consistently with what we see on Linux.
^ 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).