-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/07/11 09:56, Paolo Bonzini wrote: I'm not sure if GCC will currently delete the "if" statement in > > try { x = x.getSomething(); } catch (NullPointerException npe) { } > > if (x) ... > > but even if it doesn't, the Java front-end should probably reset > flag_delete_null_pointer_checks. Agreed. Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
OK for trunk? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOwfKUAAoJEBRtltQi2kC74vUIALaNiAGCHwU0ysflj4ZfqNjx bMH/sUbkqCOx64xUbh43js8yPFvRZkcmLRgvJNc+D/XXhdvNbvGzWlFzzIgmjwnH +a6G+fkuL5FkxhA9IrNWTH/IbYqf0onfnhcgNKgMdhEgdMxfwiScocye68TP7CrB Jo/McnCe7xN9XVIvPTeSvz7q5mh5lOuoEhIFKyMGpFDE9vyMQpiPMkdZrNLwpmf7 IUS/V6Q6eIu9Z165DDMbR5DllQ7G9pclm7sZWmUgnF1jsIt22ZMhJPGJCyrSfSt3 efsxoT5pRoopbpdh0HAhQiS43KlPi75sQJwr73s48lhB4uPYEGjpj9JVniBB5l4= =82BQ -----END PGP SIGNATURE-----
* lang.c (java_init_options_struct): Disable optimizations which assume a NULL pointer dereference will cause a fault. Index: lang.c =================================================================== *** lang.c (revision 181321) --- lang.c (working copy) *************** java_init_options_struct (struct gcc_opt *** 556,561 **** --- 556,565 ---- /* Java requires left-to-right evaluation of subexpressions. */ opts->x_flag_evaluation_order = 1; + + /* Java catches catch NULL pointer exceptions, thus we can not necessarily + rely on a pointer having a non-NULL value after a dereference. */ + opts->x_flag_delete_null_pointer_checks = 0; } static void