public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60157] New: adding -mstrict-align for i386 and x86_64 architecture
@ 2014-02-12 8:50 vinxxe at gmail dot com
2014-02-12 8:51 ` [Bug target/60157] " vinxxe at gmail dot com
2024-04-08 0:34 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: vinxxe at gmail dot com @ 2014-02-12 8:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60157
Bug ID: 60157
Summary: adding -mstrict-align for i386 and x86_64 architecture
Product: gcc
Version: 4.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: vinxxe at gmail dot com
Created attachment 32113
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32113&action=edit
source code to reproduce the problem
the pthread_cond_wait nptl function enters an infinite loop, never suspending
the calling thread, if the address of the condition variable is misaligned.
Now, this is not a gcc bug, obviously, but my question is:
does it make sense to add the target option
-mstrict-align
to the i386 and x86_64 architectures, so that these kind of problem can be
detected at compilation time?
attached you will find a source code example to reproduce the problem
execute the program with
strace -f <exec_name>
to see a neverending series of
[pid 2922] futex(0x80499fd, FUTEX_WAIT_PRIVATE, 1, NULL) = -1 EINVAL (Invalid
argument)
here follows some info of my linux machine
----------------------------------------------------------------
cat /proc/version
Linux version 2.6.32-220.7.1.el6.centos.plus.i686 (root@thalix11dev) (gcc
version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Mon Oct 21 07:05:28
UTC 2013
rpm -qa | grep glibc
glibc-devel-2.12-1.47.i686
glibc-common-2.12-1.47.i686
glibc-2.12-1.47.i686
glibc-debuginfo-2.12-1.47.i686
glibc-headers-2.12-1.47.i686
glibc-utils-2.12-1.47.i686
glibc-debuginfo-common-2.12-1.47.i686
glibc-static-2.12-1.47.i686
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 4
cpu MHz : 2799.930
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc up pebs bts
pni dtes64 monitor ds_cpl cid xtpr
bogomips : 5586.31
clflush size : 64
cache_alignment : 128
address sizes : 36 bits physical, 32 bits virtual
power management:
rpm -qa | grep gcc
gcc-4.4.6-3.el6.i686
libgcc-4.4.6-3.el6.i686
gcc-c++-4.4.6-3.el6.i686
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/60157] adding -mstrict-align for i386 and x86_64 architecture
2014-02-12 8:50 [Bug target/60157] New: adding -mstrict-align for i386 and x86_64 architecture vinxxe at gmail dot com
@ 2014-02-12 8:51 ` vinxxe at gmail dot com
2024-04-08 0:34 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: vinxxe at gmail dot com @ 2014-02-12 8:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60157
vinxxe at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/60157] adding -mstrict-align for i386 and x86_64 architecture
2014-02-12 8:50 [Bug target/60157] New: adding -mstrict-align for i386 and x86_64 architecture vinxxe at gmail dot com
2014-02-12 8:51 ` [Bug target/60157] " vinxxe at gmail dot com
@ 2024-04-08 0:34 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-08 0:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60157
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>-mstrict-align
Will not help in this case really as GCC does not warn.
Note clang does warn with -mstrict-align though:
```
<source>:15:18: warning: field C within 'cond_mutex_t' is less aligned than
'pthread_cond_t' and is usually due to 'cond_mutex_t' being packed, which can
lead to unaligned accesses [-Wunaligned-access]
15 | pthread_cond_t C;
| ^
```
But I suspect GCC should warn even without strict alignment really.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-08 0:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 8:50 [Bug target/60157] New: adding -mstrict-align for i386 and x86_64 architecture vinxxe at gmail dot com
2014-02-12 8:51 ` [Bug target/60157] " vinxxe at gmail dot com
2024-04-08 0:34 ` pinskia 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).