[ was: Re: [C/C++] Add support for #pragma GCC unroll v3 ]
On 11/25/2017 11:15 AM, Eric Botcazou wrote:
Index: testsuite/c-c++-common/unroll-5.c =================================================================== --- testsuite/c-c++-common/unroll-5.c (revision 0) +++ testsuite/c-c++-common/unroll-5.c (working copy) @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +extern void bar (int); + +int j; + +void test (void) +{ + #pragma GCC unroll 4+4 + for (unsigned long i = 1; i <= 8; ++i) + bar(i); + + #pragma GCC unroll -1 /* { dg-error "requires an assignment-expression that evaluates to a non-negative integral constant less than or equal to" } */ + for (unsigned long i = 1; i <= 8; ++i) + bar(i); + + #pragma GCC unroll 20000000000 /* { dg-error "requires an assignment-expression that evaluates to a non-negative integral constant less than or equal to" } */ + for (unsigned long i = 1; i <= 8; ++i) + bar(i); + + #pragma GCC unroll j /* { dg-error "requires an assignment-expression that evaluates to a non-negative integral constant less than or equal to" } */ + /* { dg-error "cannot appear in a constant-expression|is not usable in a constant expression" "" { target c++ } 21 } */ + for (unsigned long i = 1; i <= 8; ++i) + bar(i); + + #pragma GCC unroll 4.2 /* { dg-error "requires an assignment-expression that evaluates to a non-negative integral constant less than or equal to" } */ + for (unsigned long i = 1; i <= 8; ++i) + bar(i); +}
Hi, this patch changes the absolute line number into a relative one. Tested on x86_64 and committed. Thanks, - Tom
Use relative line number in unroll-5.c 2017-12-26 Tom de Vries <t...@codesourcery.com> * c-c++-common/unroll-5.c: Use relative line number. --- gcc/testsuite/c-c++-common/unroll-5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/unroll-5.c b/gcc/testsuite/c-c++-common/unroll-5.c index 754f3b1..b728066 100644 --- a/gcc/testsuite/c-c++-common/unroll-5.c +++ b/gcc/testsuite/c-c++-common/unroll-5.c @@ -19,7 +19,7 @@ void test (void) bar(i); #pragma GCC unroll j /* { dg-error "requires an assignment-expression that evaluates to a non-negative integral constant less than" } */ - /* { dg-error "cannot appear in a constant-expression|is not usable in a constant expression" "" { target c++ } 21 } */ + /* { dg-error "cannot appear in a constant-expression|is not usable in a constant expression" "" { target c++ } .-1 } */ for (unsigned long i = 1; i <= 8; ++i) bar(i);