This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unspecified behaviour in java/gjavah.c


Diego Novillo writes:
 > After the latest merge from basic-improvements to tree-ssa, I
 > started getting failures building libjava:
 > 
 > 
 > Below is a minimal test case that exhibits the same problem:
 > 
 > -----------------------------------------------------------------------------
 > struct JCF {
 >   char *read_ptr;
 > } *jcf;
 > 
 > foo()
 > {
 >   jcf->read_ptr += (jcf->read_ptr += 4, 5);
 > }
 > -----------------------------------------------------------------------------
Ah.  Nasty.

This is such a common problem when programming in C that I wonder if
we could include code in gcc to detect it.

When we gimplify, could we easily detect the same lvalue being updated
more than once between sequence points?

 > 	* java/jcf-reader.c: Don't expand JCF_readu4 inside the
 > 	expansion of JCF_SKIP.

OK.

Thanks for finding this.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]