[PATCH 2/2] Add test cases for noreorder

Mike Stump mikestump@comcast.net
Sun Sep 14 18:38:00 GMT 2014


On Sep 14, 2014, at 10:51 AM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Add some simple test cases for noreorder behaving like
> -fno-toplevel-reorder and -fno-toplevel-reorder still working.
> Unfortunately there's no easy way to check for output order in DG,
> so we just check for existence.

I thought some of these would span lines…. foo.*bar  could check foo on a line before bar?

/* { dg-final { scan-assembler "section.*foo" } } */

int foo (int a)
{
  static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
  void *p = &&l1 + ar[a];
  goto *p;
  l1:
    return 1;
  l2:
    return 2;
}

Yup, works just fine.  Some might say it isn’t a feature, but we have no plans to fix it.


More information about the Gcc-patches mailing list