> Hmm, I don't see this.

Usual scheduler-sensitive stuff I guess, here's the assembly I have:

        movq    aliasing3_pkg__pointer(%rip), %rax
        testq   %rax, %rax
        je      .L6
        cmpl    $5, aliasing3_pkg__block(%rip)
        movl    $5, (%rax)

insns #4 and #5 have been wrongly swapped.

> >In Ada we don't mark (external) variables as addressable if we don't
> >see their address taken.
> 
> You have to (now).  The testing was of course to detect this...

Well, you need to define what TREE_ADDRESSABLE means now, because according to

/* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means address
   of this is needed.  So it cannot be in a register.
[...]
#define TREE_ADDRESSABLE(NODE) ((NODE)->base.addressable_flag)

your change is clearly wrong and the Ada compiler clearly right.  And auditing 
the various front-ends might also be in order here if they really need to mark 
every single external variable as addressable to be safe wrt aliasing.

Obvious testcase for the C compiler attached, compile at -O2.

This looks like a big hack to work around an LTO issue...

-- 
Eric Botcazou
extern int a;
extern int *p;

int main (void)
{
  *p = 0;
  a = 1;
  test ();
}
extern void abort (void);

int a;
int *p = &a;

void test (void)
{
  if (a != 1)
    abort ();
}

Reply via email to