public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
@ 2011-07-19 12:50 ` ro at gcc dot gnu.org
2011-07-19 13:59 ` ro at CeBiTec dot Uni-Bielefeld.DE
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-19 12:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.07.19 12:46:17
CC| |ro at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-19 12:46:17 UTC ---
Confirmed, easy to see with uac p noprint nofix sigbus, i.e. unaligned accesses
not fixed up, but instead generating SIGBUS.
Will rebuild libgomp with -g3 -O0 to allow for debugging/investigation.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
2011-07-19 12:50 ` [Bug libgomp/45351] many unaligned accesses in libgomp tests ro at gcc dot gnu.org
@ 2011-07-19 13:59 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-19 14:00 ` ro at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-07-19 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-07-19 13:57:43 UTC ---
I see what's happening now: the unaligned access is happending inside
librt (sem_wait), with uac p noprint nofix sigbus:
Program received signal SIGBUS, Bus error.
[Switching to Thread 1]
0x000003ff81086c98 in sem_init () from /usr/shlib/librt.so
(gdb) Erroneous arithmetic operation.
(gdb) where
#0 0x000003ff81086c98 in sem_init () from /usr/shlib/librt.so
#1 0x000003ffbffefdec in gomp_sem_init (sem=0x3ffbfff02a0, value=536854016)
at /vol/gcc/src/hg/trunk/local/libgomp/config/posix/sem.h:72
#2 0x000003ffbfff02a0 in gomp_init_task (task=0x14002bf00, parent_task=0x0,
prev_icv=0x3ffffff0020) at /vol/gcc/src/hg/trunk/local/libgomp/task.c:45
#3 0x000003ffbfff1eb4 in gomp_team_start (fn=0x11fffe300, data=0x11fffe310,
nthreads=536863560, team=0x11fffe358)
at /vol/gcc/src/hg/trunk/local/libgomp/team.c:292
#4 0x000003ffbffef148 in GOMP_parallel_start (
fn=0x120002db4 <sub1._omp_fn.0>, data=0x11fffbfd0, num_threads=1)
at /vol/gcc/src/hg/trunk/local/libgomp/parallel.c:108
#5 0x0000000120002cfc in sub1 (n=2)
at
/vol/gcc/src/hg/trunk/local/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c:30
#6 0x0000000120002d68 in main ()
at
/vol/gcc/src/hg/trunk/local/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c:40
The actual unaligned access is one insn before:
(gdb) x/i 0x3ff81086c94
0x3ff81086c94 <sem_init+308>: stl zero,0(s0)
(gdb) p/x $s0
$17 = 0x14002bf5e
Unaligned access pid=391884 <a.15.1.exe> va=0x14002bf5e pc=0x3ff81086c94
ra=0x3ff81086bf4 inst=0xb3e90000
And indeed *s0 isn't 4-byte aligned, as required by the stl insn.
I could trace this as follows:
* gomp_sem_t is sem_t (config/posix/sem.h)
* sem_t is psx4_key_t (from <semaphore.h>)
* psx4_key_t is defined in <psx4_nspace_ts.h>:
typedef unsigned short psx4_key_version_t;
typedef unsigned short psx4_key_index_t;
typedef struct psx4_key
{
psx4_key_index_t index; /* Index of entry */
psx4_key_version_t version; /* Version number of key */
} psx4_key_t;
Looking at the Tru64 UNIX V5.1 sources, I find (in
src/usr/ccs/lib/librt/psx4_csem.c (sem_init)):
int
sem_init(sem_t *sem, int pshared, unsigned int value)
[...]
*(int *)sem = 0;
i.e. the code assumes int (4-byte) alignment, but only gets short
(2-byte) alignment instead.
An appropriate attribute should fix this. Don't know how best to fit
this into libgomp.
Rainer
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
2011-07-19 12:50 ` [Bug libgomp/45351] many unaligned accesses in libgomp tests ro at gcc dot gnu.org
2011-07-19 13:59 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-07-19 14:00 ` ro at gcc dot gnu.org
2011-07-19 14:15 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-19 14:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Version|unknown |4.7.0
Target Milestone|--- |4.7.0
--- Comment #4 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-19 13:59:22 UTC ---
Jakuk, what would be the best/least intrusive way to handle this
target-specific
gomp_sem_t alignment requirement?
Rainer
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-07-19 14:00 ` ro at gcc dot gnu.org
@ 2011-07-19 14:15 ` jakub at gcc dot gnu.org
2011-07-19 14:33 ` ro at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-19 14:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-19 14:14:22 UTC ---
You mean that __alignof (sem_t) is 2, yet librt assumes it is 4 byte aligned?
These proprietary OSes are of terrible quality.
You could add config/osf/sem.h, which would be a copy of config/posix/sem.h,
just gomp_sem_t would be typedef sem_t gomp_sem_t __attribute__((aligned
(__alignof__ (int))));
or something similar, and in configury ensure that this directory is searched
on these buggy OSes before config/posix/.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-07-19 14:15 ` jakub at gcc dot gnu.org
@ 2011-07-19 14:33 ` ro at gcc dot gnu.org
2011-07-19 15:16 ` jay.krell at cornell dot edu
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-19 14:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |ro at gcc dot gnu.org
|gnu.org |
--- Comment #7 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-19 14:32:25 UTC ---
Mine.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2011-07-19 14:33 ` ro at gcc dot gnu.org
@ 2011-07-19 15:16 ` jay.krell at cornell dot edu
2011-07-19 15:25 ` ro at CeBiTec dot Uni-Bielefeld.DE
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jay.krell at cornell dot edu @ 2011-07-19 15:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #8 from Jay <jay.krell at cornell dot edu> 2011-07-19 15:15:46 UTC ---
Is there no annotation in /usr/include/whatever.h to get the required
alignment? Maybe that gcc doesn't-but-maybe-should understand?
- Jay (phone)
On Jul 19, 2011, at 7:33 AM, "ro at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
>
> Rainer Orth <ro at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |ASSIGNED
> AssignedTo|unassigned at gcc dot |ro at gcc dot gnu.org
> |gnu.org |
>
> --- Comment #7 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-19 14:32:25 UTC ---
> Mine.
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2011-07-19 15:16 ` jay.krell at cornell dot edu
@ 2011-07-19 15:25 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-19 15:58 ` jay.krell at cornell dot edu
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-07-19 15:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #9 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-07-19 15:23:47 UTC ---
> --- Comment #8 from Jay <jay.krell at cornell dot edu> 2011-07-19 15:15:46 UTC ---
> Is there no annotation in /usr/include/whatever.h to get the required
> alignment? Maybe that gcc doesn't-but-maybe-should understand?
No, the section I cited is all there is. No idea why this error doesn't
show up otherwise.
Rainer
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2011-07-19 15:25 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-07-19 15:58 ` jay.krell at cornell dot edu
2011-07-19 16:58 ` ro at CeBiTec dot Uni-Bielefeld.DE
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jay.krell at cornell dot edu @ 2011-07-19 15:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #10 from Jay <jay.krell at cornell dot edu> 2011-07-19 15:58:04 UTC ---
>> Is there no annotation in /usr/include/whatever.h to get the required
>> alignment? Maybe that gcc doesn't-but-maybe-should understand?
>
> No, the section I cited is all there is. No idea why this error doesn't
> show up otherwise.
Do struct alignment rules on Tru64 have an effect? Not that I
looked-up/read the ABI details..
I'm not sure I have Tru64 access any longer (and my
time/work/money-to-burn has dramatically declined, sorry, it was fun!)
But I'd be curious what this does:
#include something
#include stddef.h
int main()
{
typedef struct { char a; sem_t b; } t1;
printf("%u %u\n", sizeof(t1), offsetof(t1, b));
return 0;
}
5 or 6 or 8 or other?
and 1 or 2 or 4 or other?
If the alignment is really only 2, then I'd expect 6 and 2.
If the alignment is somehow bumped up, then 8 and 4.
The code cited does seem poor.
Personally I'm a big fan of memset(p, 0, n) (or #define ZeroMemory(p, n)).
- Jay
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2011-07-19 15:58 ` jay.krell at cornell dot edu
@ 2011-07-19 16:58 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-22 17:05 ` ro at CeBiTec dot Uni-Bielefeld.DE
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-07-19 16:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #11 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-07-19 16:57:00 UTC ---
> Do struct alignment rules on Tru64 have an effect? Not that I
> looked-up/read the ABI details..
I had a look at `Calling Standard for Alpha Systems', and the rules
seemed as expected and straight-forward.
> But I'd be curious what this does:
>
> #include something
> #include stddef.h
>
>
> int main()
> {
> typedef struct { char a; sem_t b; } t1;
> printf("%u %u\n", sizeof(t1), offsetof(t1, b));
> return 0;
> }
>
> 5 or 6 or 8 or other?
> and 1 or 2 or 4 or other?
> If the alignment is really only 2, then I'd expect 6 and 2.
This is what I get, with both cc and gcc.
Rainer
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2011-07-19 16:58 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-07-22 17:05 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-25 15:43 ` ro at gcc dot gnu.org
2011-07-25 15:45 ` ro at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2011-07-22 17:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #12 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-07-22 17:04:33 UTC ---
To make completely sure that this isn't a gcc problem of some sort, I've
derived a testcase from libgomp. If built with cc -c99 or gcc, it shows
the same unaligned access, so this is really just a silly librt bug,
nothing else.
Rainer
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2011-07-22 17:05 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2011-07-25 15:43 ` ro at gcc dot gnu.org
2011-07-25 15:45 ` ro at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-25 15:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #13 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-25 15:39:58 UTC ---
Author: ro
Date: Mon Jul 25 15:39:52 2011
New Revision: 176755
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176755
Log:
PR libgomp/45351
* config/osf/sem.h: New file.
* configure.tgt (alpha*-dec-osf*): Prepend osf to config_path.
Added:
trunk/libgomp/config/osf/
trunk/libgomp/config/osf/sem.h
Modified:
trunk/libgomp/ChangeLog
trunk/libgomp/configure.tgt
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2011-07-25 15:43 ` ro at gcc dot gnu.org
@ 2011-07-25 15:45 ` ro at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-25 15:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
URL| |http://gcc.gnu.org/ml/gcc-p
| |atches/2011-07/msg02162.htm
| |l
Resolution| |FIXED
--- Comment #14 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-25 15:40:44 UTC ---
Fixed for 4.7.0.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libgomp/45351] many unaligned accesses in libgomp tests
2010-08-20 6:49 [Bug libgomp/45351] New: " jay dot krell at cornell dot edu
@ 2010-08-23 20:20 ` rguenth at gcc dot gnu dot org
0 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-23 20:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2010-08-23 20:20 -------
Can you possibly reduce one testcase?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-07-25 15:45 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-45351-4@http.gcc.gnu.org/bugzilla/>
2011-07-19 12:50 ` [Bug libgomp/45351] many unaligned accesses in libgomp tests ro at gcc dot gnu.org
2011-07-19 13:59 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-19 14:00 ` ro at gcc dot gnu.org
2011-07-19 14:15 ` jakub at gcc dot gnu.org
2011-07-19 14:33 ` ro at gcc dot gnu.org
2011-07-19 15:16 ` jay.krell at cornell dot edu
2011-07-19 15:25 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-19 15:58 ` jay.krell at cornell dot edu
2011-07-19 16:58 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-22 17:05 ` ro at CeBiTec dot Uni-Bielefeld.DE
2011-07-25 15:43 ` ro at gcc dot gnu.org
2011-07-25 15:45 ` ro at gcc dot gnu.org
2010-08-20 6:49 [Bug libgomp/45351] New: " jay dot krell at cornell dot edu
2010-08-23 20:20 ` [Bug libgomp/45351] " rguenth at gcc dot gnu 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).