On 08/06/15 17:31, Jakub Jelinek wrote: > On Mon, Jun 08, 2015 at 02:04:12PM +0200, Tom de Vries wrote: >> this patch fixes PR66444, a problem with -fipa-ra in reload_combine. >> >> The problem is that for the test-case, reload_combine combines these two >> insns: > > Please work out with Vlad whether reload_cse_move2add doesn't need similar > fix (and check other spots too). > >> 2015-06-08 Tom de Vries >> >> PR rtl-optimization/66444 >> * postreload.c (reload_combine): Use get_call_reg_set_usage instead of >> call_used_regs. > > LGTM. > >> * gcc.dg/pr66444.c: New test. > >> +int __attribute__((noinline, noclone)) >> +baz (void) >> +{ >> + struct S *x = (struct S *) 0xe0000000U; > > I'm still afraid this will not really work on s390-linux (which has only > 31-bit pointers) and will not work on 16-bit int targets either > (some have say 24-bit pointers etc., not really familiar with the embedded > world). > So, I'd suggest use a macro for the address, so you don't need to duplicate > it, Used a macro CONST_PTR. > and define it to say ((struct S *) 0x8000UL), if it reproduces > even with that change without your reload_combine fix. Unfortunately, it didn't. So I used __SIZEOF_POINTER__ to produce a valid constant pointer for the 16-31 bit pointer-size cases, while still triggering the original problem for x86_64 -m64 case using a larger pointer. Furthermore, I used __SIZEOF_POINTER__ to ensured a valid pointer constant suffix. > > Ok for trunk and 5.2 with that change. Committed to trunk and backported gcc-5-branch as attached. Thanks, - Tom