------- Comment #4 from jakub at gcc dot gnu dot org 2008-03-18 11:14 ------- Seems OMP_ATOMIC_LOAD isn't properly regimplified and so &i in TREE_OPERAND (omp_atomic_load, 1) isn't replaced with .omp_data_i->i. For targets with sync builtins this doesn't matter, as expand_omp_atomic for them runs all addr references through force_gimple_operand_bsi and thus it is gimplified at expand_omp time. But the expand_omp_atomic_mutex fallback just assumes the address is gimple value.
Here is a fix I'll be testing (though for hppa-linux I can only eyeball the assembly). 2008-03-18 Jakub Jelinek <[EMAIL PROTECTED]> PR middle-end/35611 * gimplify.c (gimplify_expr): Gimplify second operand of OMP_ATOMIC_LOAD. --- gcc/gimplify.c.jj 2008-03-06 18:45:59.000000000 +0100 +++ gcc/gimplify.c 2008-03-18 11:55:04.000000000 +0100 @@ -6022,12 +6022,18 @@ gimplify_expr (tree *expr_p, tree *pre_p case OMP_RETURN: case OMP_CONTINUE: - case OMP_ATOMIC_LOAD: - case OMP_ATOMIC_STORE: - + case OMP_ATOMIC_STORE: ret = GS_ALL_DONE; break; + case OMP_ATOMIC_LOAD: + if (gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, NULL, + is_gimple_val, fb_rvalue) != GS_ALL_DONE) + ret = GS_ERROR; + else + ret = GS_ALL_DONE; + break; + case POINTER_PLUS_EXPR: /* Convert ((type *)A)+offset into &A->field_of_type_and_offset. The second is gimple immediate saving a need for extra statement. libgomp.c/pr26943-4.c used to fail intermitently before http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132977 but I certainly can't reproduce it with current trunk or 4.3, and I don't see how this could be related to this - even -m32 -march=i386 has the needed sync builtins - both QImode and SImode lock; add{b,l}. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Component|libgomp |middle-end Last reconfirmed|2008-03-18 00:09:30 |2008-03-18 11:14:25 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35611