testsuite: Fix gcc.dg/analyzer/allocation-size-multiline-[123].c [PR 110426]

Message ID 20230808150121.318595-1-christophe.lyon@linaro.org
State Unresolved
Headers
Series testsuite: Fix gcc.dg/analyzer/allocation-size-multiline-[123].c [PR 110426] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Christophe Lyon Aug. 8, 2023, 3:01 p.m. UTC
  For 32-bit newlib targets (e.g. arm-eabi)  int32_t is "long int".

Like previous patches in these tests, update the matching regexps to
match "aka (long )?int".

Tested on arm-eabi and aarch64-linux-gnu.

2023-08-08  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	PR analyzer/110426
	* gcc.dg/analyzer/allocation-size-multiline-1.c: Handle
	int32_t being "long int".
	* gcc.dg/analyzer/allocation-size-multiline-2.c: Likewise.
	* gcc.dg/analyzer/allocation-size-multiline-3.c: Likewise.
---
 gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c | 6 +++---
 gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c | 6 +++---
 gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
  

Comments

David Malcolm Aug. 9, 2023, 8:30 p.m. UTC | #1
On Tue, 2023-08-08 at 15:01 +0000, Christophe Lyon wrote:
> For 32-bit newlib targets (e.g. arm-eabi)  int32_t is "long int".
> 
> Like previous patches in these tests, update the matching regexps to
> match "aka (long )?int".
> 
> Tested on arm-eabi and aarch64-linux-gnu.

Sorry about this breakage.

These tests used to emit the infomation as multiple messages, but were
consolidated as a side-effect of r14-3001-g021077b94741c9.

I've just committed r14-3114-g73da34a538ddc2, a cleanup of the analyzer
code, which has a side-effect of splitting the messages back up.  I
believe that r14-3114 restores these tests to their pre-r14-3001 state,
but I might have messed up.

Does r14-3114-g73da34a538ddc2 fix the issues for you, or is some
patching still needed?

Dave


> 
> 2023-08-08  Christophe Lyon  <christophe.lyon@linaro.org>
> 
>         gcc/testsuite/
>         PR analyzer/110426
>         * gcc.dg/analyzer/allocation-size-multiline-1.c: Handle
>         int32_t being "long int".
>         * gcc.dg/analyzer/allocation-size-multiline-2.c: Likewise.
>         * gcc.dg/analyzer/allocation-size-multiline-3.c: Likewise.
> ---
>  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c | 6 +++-
> --
>  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c | 6 +++-
> --
>  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c | 4 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> 1.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> index 9938ba237a0..b56e4b4e8e1 100644
> --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> @@ -16,7 +16,7 @@ void test_constant_1 (void)
>      |   int32_t *ptr = __builtin_malloc (1);
>      |                  ^~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 1 bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 1 bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> @@ -34,7 +34,7 @@ void test_constant_2 (void)
>      |   int32_t *ptr = __builtin_malloc (2);
>      |                  ^~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 2 bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 2 bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> @@ -52,6 +52,6 @@ void test_symbolic (int n)
>      |   int32_t *ptr = __builtin_malloc (n * 2);
>      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
> diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> 2.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> index 9e1269cbb7a..8912913a78c 100644
> --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> @@ -16,7 +16,7 @@ void test_constant_1 (void)
>      |   int32_t *ptr = __builtin_alloca (1);
>      |                  ^~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 1 bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 1 bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> @@ -33,7 +33,7 @@ void test_constant_2 (void)
>      |   int32_t *ptr = __builtin_alloca (2);
>      |                  ^~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 2 bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 2 bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> @@ -50,7 +50,7 @@ void test_symbolic (int n)
>      |   int32_t *ptr = __builtin_alloca (n * 2);
>      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
>      |                  |
> -    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> 3.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> index 71790d91753..88fc8edee7f 100644
> --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> @@ -20,7 +20,7 @@ void test_constant_99 (void)
>      |   int32_t *ptr = alloca (99);
>      |                  ^~~~~~
>      |                  |
> -    |                  (1) allocated 99 bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 99 bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
>  
> @@ -37,6 +37,6 @@ void test_symbolic (int n)
>      |   int32_t *ptr = alloca (n * 2);
>      |                  ^~~~~~
>      |                  |
> -    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> +    |                  (1) allocated 'n * 2' bytes and assigned to
> 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> {re:long :re?}int})' is '4'
>      |
>     { dg-end-multiline-output "" } */
  
Christophe Lyon Aug. 10, 2023, 11:55 a.m. UTC | #2
Hi!

On Wed, 9 Aug 2023 at 22:30, David Malcolm <dmalcolm@redhat.com> wrote:

> On Tue, 2023-08-08 at 15:01 +0000, Christophe Lyon wrote:
> > For 32-bit newlib targets (e.g. arm-eabi)  int32_t is "long int".
> >
> > Like previous patches in these tests, update the matching regexps to
> > match "aka (long )?int".
> >
> > Tested on arm-eabi and aarch64-linux-gnu.
>
> Sorry about this breakage.
>
> These tests used to emit the infomation as multiple messages, but were
> consolidated as a side-effect of r14-3001-g021077b94741c9.
>
> I've just committed r14-3114-g73da34a538ddc2, a cleanup of the analyzer
> code, which has a side-effect of splitting the messages back up.  I
> believe that r14-3114 restores these tests to their pre-r14-3001 state,
> but I might have messed up.
>
> Does r14-3114-g73da34a538ddc2 fix the issues for you, or is some
> patching still needed?
>
>
Thanks, indeed the tests pass again (both aarch64 and arm targets)

Christophe


> Dave
>
>
> >
> > 2023-08-08  Christophe Lyon  <christophe.lyon@linaro.org>
> >
> >         gcc/testsuite/
> >         PR analyzer/110426
> >         * gcc.dg/analyzer/allocation-size-multiline-1.c: Handle
> >         int32_t being "long int".
> >         * gcc.dg/analyzer/allocation-size-multiline-2.c: Likewise.
> >         * gcc.dg/analyzer/allocation-size-multiline-3.c: Likewise.
> > ---
> >  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c | 6 +++-
> > --
> >  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c | 6 +++-
> > --
> >  gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c | 4 ++--
> >  3 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> > 1.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> > index 9938ba237a0..b56e4b4e8e1 100644
> > --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> > +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
> > @@ -16,7 +16,7 @@ void test_constant_1 (void)
> >      |   int32_t *ptr = __builtin_malloc (1);
> >      |                  ^~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 1 bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 1 bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > @@ -34,7 +34,7 @@ void test_constant_2 (void)
> >      |   int32_t *ptr = __builtin_malloc (2);
> >      |                  ^~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 2 bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 2 bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > @@ -52,6 +52,6 @@ void test_symbolic (int n)
> >      |   int32_t *ptr = __builtin_malloc (n * 2);
> >      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> > diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> > 2.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> > index 9e1269cbb7a..8912913a78c 100644
> > --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> > +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
> > @@ -16,7 +16,7 @@ void test_constant_1 (void)
> >      |   int32_t *ptr = __builtin_alloca (1);
> >      |                  ^~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 1 bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 1 bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > @@ -33,7 +33,7 @@ void test_constant_2 (void)
> >      |   int32_t *ptr = __builtin_alloca (2);
> >      |                  ^~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 2 bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 2 bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > @@ -50,7 +50,7 @@ void test_symbolic (int n)
> >      |   int32_t *ptr = __builtin_alloca (n * 2);
> >      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
> >      |                  |
> > -    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-
> > 3.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> > index 71790d91753..88fc8edee7f 100644
> > --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> > +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
> > @@ -20,7 +20,7 @@ void test_constant_99 (void)
> >      |   int32_t *ptr = alloca (99);
> >      |                  ^~~~~~
> >      |                  |
> > -    |                  (1) allocated 99 bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 99 bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
> >
> > @@ -37,6 +37,6 @@ void test_symbolic (int n)
> >      |   int32_t *ptr = alloca (n * 2);
> >      |                  ^~~~~~
> >      |                  |
> > -    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
> > +    |                  (1) allocated 'n * 2' bytes and assigned to
> > 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka
> > {re:long :re?}int})' is '4'
> >      |
> >     { dg-end-multiline-output "" } */
>
>
  

Patch

diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
index 9938ba237a0..b56e4b4e8e1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-1.c
@@ -16,7 +16,7 @@  void test_constant_1 (void)
     |   int32_t *ptr = __builtin_malloc (1);
     |                  ^~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 1 bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 1 bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
@@ -34,7 +34,7 @@  void test_constant_2 (void)
     |   int32_t *ptr = __builtin_malloc (2);
     |                  ^~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 2 bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 2 bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
@@ -52,6 +52,6 @@  void test_symbolic (int n)
     |   int32_t *ptr = __builtin_malloc (n * 2);
     |                  ^~~~~~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
index 9e1269cbb7a..8912913a78c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-2.c
@@ -16,7 +16,7 @@  void test_constant_1 (void)
     |   int32_t *ptr = __builtin_alloca (1);
     |                  ^~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 1 bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 1 bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
@@ -33,7 +33,7 @@  void test_constant_2 (void)
     |   int32_t *ptr = __builtin_alloca (2);
     |                  ^~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 2 bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 2 bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
@@ -50,7 +50,7 @@  void test_symbolic (int n)
     |   int32_t *ptr = __builtin_alloca (n * 2);
     |                  ^~~~~~~~~~~~~~~~~~~~~~~~
     |                  |
-    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
index 71790d91753..88fc8edee7f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c
@@ -20,7 +20,7 @@  void test_constant_99 (void)
     |   int32_t *ptr = alloca (99);
     |                  ^~~~~~
     |                  |
-    |                  (1) allocated 99 bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 99 bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */
 
@@ -37,6 +37,6 @@  void test_symbolic (int n)
     |   int32_t *ptr = alloca (n * 2);
     |                  ^~~~~~
     |                  |
-    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4'
+    |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
     |
    { dg-end-multiline-output "" } */