On Mon, 2024-07-22 at 11:37 +0100, Joern Wolfgang Rennecke wrote:
> While on x86_64-pc-linux-gnu, the second diagram shows the type
> written 
> as 'int', as expected, on a 16 and 32 bit newlib based toolchain, it
> is 
> being output as int32_t .  And all the formatting is also a bit 
> different, probably due to the change in how the int32_t is
> displayed.

Sorry about over-specifying the tests output.

> 
> What do other people see on toolchains where the regression tests 
> actually have I/O functionality?


FWIW on my x86_64-pc-linux-gnu with
 make check-gcc RUNTESTFLAGS="-v -v --target_board=unix\{-m32,-m64\} 
analyzer.exp=out-of-bounds-diagram-11.c"
I see this output for the 2nd test:

                                 ┌───────────────────────────────────────┐
                                 │          write of '(int) 42'          │
                                 └───────────────────────────────────────┘
                                           │                   │
                                           │                   │
                                           v                   v
  ┌──────────────────────────────────────────────────┐┌──────────────────┐
  │         buffer allocated on stack at (1)         ││after valid range │
  └──────────────────────────────────────────────────┘└──────────────────┘
  ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
                           │                                   │
          ╭────────────────┴───────────────╮         ╭─────────┴────────╮
          │capacity: '(size * 4) + 3' bytes│         │overflow of 1 byte│
          ╰────────────────────────────────╯         ╰──────────────────╯


Does it help to hack this change into prune.exp:

diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp
index d00d37f015f7..f467d1a97bc6 100644
--- a/gcc/testsuite/lib/prune.exp
+++ b/gcc/testsuite/lib/prune.exp
@@ -109,7 +109,7 @@ proc prune_gcc_output { text } {
     # Many tests that use visibility will still pass on platforms that don't 
support it.
     regsub -all "(^|\n)\[^\n\]*lto1: warning: visibility attribute not 
supported in this configuration; ignored\[^\n\]*" $text "" text
 
-    #send_user "After:$text\n"
+    send_user "After:$text\n"
 
     return $text
 }


> 
> Would it make sense to handle this with one multi-line pattern for 
> newlib based toolchains, ending with
>     { dg-end-multiline-output "" { target *-*-elf } } */
>   and one for glibc based toolchain, ending in
>     { dg-end-multiline-output "" { target !*-*-elf } } */
>   ?

Presumably the only difference is in the top-right hand box of the
diagram, whereas my objective for those tests was more about the lower
part of the diagram - I wanted to verify how we handle symbolic buffer
sizes (e.g. (size * 4) + 3, and other run-time-computer sizes).

It's rather awkward to test the diagrams with DejaGnu, alas.

Would it might make sense to split out that file into three separate
tests -11a, -11b, and -11c, and be more aggressive about only running
the 2nd test on targets that we know generate "int" in the top-right
box?

> 
> I have no idea what toolchains with different libraries (and hence 
> header files) would see.
> 

Sorry again about this
Dave

Reply via email to