public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O
@ 2015-02-17 15:04 dirk.bonne@inform-ac.com
2015-02-17 15:52 ` [Bug middle-end/65090] " mikpelinux at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dirk.bonne@inform-ac.com @ 2015-02-17 15:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
Bug ID: 65090
Summary: GCC produces instruction with bad alignment on SPARC
when using -O
Product: gcc
Version: 4.7.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: dirk.bonne@inform-ac.com
Created attachment 34789
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34789&action=edit
Complete source code
$ uname -a
SunOS uxs450 5.10 Generic_150400-17 sun4v sparc sun4v Solaris
$ g++-4.7 -v
Using built-in specs.
COLLECT_GCC=g++-4.7
COLLECT_LTO_WRAPPER=/opt/its/runtime/gcc/4.7/libexec/gcc/sparc-sun-solaris2.10/4.7.4/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with:
/SSD/compile/toolsexternal/packages/gcc-4.7/work/gcc-4.7.4/configure
--prefix=/opt/its/runtime/gcc/4.7 --program-suffix=-4.7
--enable-languages=c,c++ --disable-multilib --disable-nls
--enable-threads=posix --enable-__cxa_atexit --enable-libstdcxx-debug
--with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 4.7.4 (GCC)
I got it down to two small files (see attachment). Reproduce it like this:
$ g++-4.7 -O -std=gnu++11 -c t.cc
$ g++-4.7 -O -std=gnu++11 -c t2.cc
$ g++-4.7 -O -std=gnu++11 -c t.cc
$ g++-4.7 -O -std=gnu++11 -c t2.cc
$ g++-4.7 -o t t.o t2.o
$ ./t
Bus Error (core dumped)
The code generated for "somefunction" is broken:
00010a68 <_Z12somefunctionv>:
10a68: 9d e3 bf 80 save %sp, -128, %sp
10a6c: c0 27 bf e4 clr [ %fp + -28 ]
10a70: c0 27 bf e8 clr [ %fp + -24 ]
10a74: c0 27 bf ec clr [ %fp + -20 ]
10a78: c0 27 bf f0 clr [ %fp + -16 ]
10a7c: c0 27 bf fb clr [ %fp + -5 ]
...
"%fp - 5" is not 4 bytes aligned and causes the bus error.
The function somefunction is in t.cc (attached), the relevant part is:
struct X {
size_t a = 0;
std::vector<X*> vec_;
X() {
vec_.emplace_back(nullptr);
}
};
void somefunction()
{
X cv;
f2(string());
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
@ 2015-02-17 15:52 ` mikpelinux at gmail dot com
2015-02-17 17:20 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mikpelinux at gmail dot com @ 2015-02-17 15:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
I can reproduce the wrong-code with g++ 4.7.4 on sparc64-linux, but g++ 4.8.4
and 5 (current trunk) work.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
2015-02-17 15:52 ` [Bug middle-end/65090] " mikpelinux at gmail dot com
@ 2015-02-17 17:20 ` jakub at gcc dot gnu.org
2015-02-18 8:54 ` dirk.bonne@inform-ac.com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-17 17:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
4.7.x is no longer supported, so if that is the case, there is nothing to do.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
2015-02-17 15:52 ` [Bug middle-end/65090] " mikpelinux at gmail dot com
2015-02-17 17:20 ` jakub at gcc dot gnu.org
@ 2015-02-18 8:54 ` dirk.bonne@inform-ac.com
2015-02-24 18:12 ` [Bug c++/65090] " ebotcazou at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dirk.bonne@inform-ac.com @ 2015-02-18 8:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
--- Comment #3 from Dirk Bonne <dirk.bonne@inform-ac.com> ---
The bug is elusive --- I then hope it is really gone from later versions and
not just hidden...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
` (2 preceding siblings ...)
2015-02-18 8:54 ` dirk.bonne@inform-ac.com
@ 2015-02-24 18:12 ` ebotcazou at gcc dot gnu.org
2015-07-01 18:01 ` jason at gcc dot gnu.org
2015-07-01 18:07 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2015-02-24 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-24
CC| |ebotcazou at gcc dot gnu.org
Component|middle-end |c++
Ever confirmed|0 |1
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
4.9.x also works, but this nevertheless looks like a latent C++ bug to me:
<<< Unknown tree: nullptr_type >>> D.29238;
D.29238 = 0;
yields with mainline:
(insn 10 9 11 2 (set (mem/c:SI (plus:SI (reg/f:SI 104 virtual-stack-vars)
(const_int -4 [0xfffffffffffffffc])) [0 D.29314+0 S4 A32])
(const_int 0 [0])) t.cc:10 -1
(nil))
But 32-bit alignment is forced by expand_one_stack_var_at, before it's 8-bit:
<var_decl 0x7ffff583e870 D.29314
type <nullptr_type 0x7ffff6e1bd20 decltype(nullptr) public unsigned type_6
SI
size <integer_cst 0x7ffff6d0af00 constant 32>
unit size <integer_cst 0x7ffff6d0af18 constant 4>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6e1bd20
pointer_to_this <pointer_type 0x7ffff5f677e0> reference_to_this
<reference_type 0x7ffff5f675e8>>
addressable used unsigned ignored SI file t.cc line 10 col 30 size
<integer_cst 0x7ffff6d0af00 32> unit size <integer_cst 0x7ffff6d0af18 4>
align 8 context <function_decl 0x7ffff5f57870 __comp_ctor > abstract_origin
<var_decl 0x7ffff5f68090 D.25687>>
In other words giving SImode to NULLPTR_TYPE with only 8-bit alignment is a bit
dubious on strict-alignment platforms like SPARC.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
` (3 preceding siblings ...)
2015-02-24 18:12 ` [Bug c++/65090] " ebotcazou at gcc dot gnu.org
@ 2015-07-01 18:01 ` jason at gcc dot gnu.org
2015-07-01 18:07 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-07-01 18:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
Bug 65090 depends on bug 65945, which changed state.
Bug 65945 Summary: C++ alignment of nullptr_t is 1 and might cause unaligned stores to the frame
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65945
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/65090] GCC produces instruction with bad alignment on SPARC when using -O
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
` (4 preceding siblings ...)
2015-07-01 18:01 ` jason at gcc dot gnu.org
@ 2015-07-01 18:07 ` jason at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2015-07-01 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65090
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jason at gcc dot gnu.org
Resolution|--- |DUPLICATE
Target Milestone|--- |5.2
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed by the patch for 65945.
*** This bug has been marked as a duplicate of bug 65945 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-07-01 18:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 15:04 [Bug middle-end/65090] New: GCC produces instruction with bad alignment on SPARC when using -O dirk.bonne@inform-ac.com
2015-02-17 15:52 ` [Bug middle-end/65090] " mikpelinux at gmail dot com
2015-02-17 17:20 ` jakub at gcc dot gnu.org
2015-02-18 8:54 ` dirk.bonne@inform-ac.com
2015-02-24 18:12 ` [Bug c++/65090] " ebotcazou at gcc dot gnu.org
2015-07-01 18:01 ` jason at gcc dot gnu.org
2015-07-01 18:07 ` jason 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).