From: Jakub Jelinek Date: Fri, 13 Mar 2026 13:11:57 +0000 (+0100) Subject: testsuite: Fix up gcc.dg/analyzer/ice-pr124375-1.c for 32-bit targets [PR124375] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c2d129334af54313285fd97ea921ea150ec9b59;p=thirdparty%2Fgcc.git testsuite: Fix up gcc.dg/analyzer/ice-pr124375-1.c for 32-bit targets [PR124375] On Wed, Mar 11, 2026 at 08:51:03PM -0400, David Malcolm wrote: > * gcc.dg/analyzer/ice-pr124375-1.c: New test. Unfortunately this test FAILs on i686-linux (and guess all other sizeof (int) == sizeof (__PTRDIFF_TYPE__) targets). The problem is that on x86_64-linux the warning is indeed emitted on the __printf_buffer_offset = __printf_buffer_spec /* { dg-warning "stack-based buffer over-read" } */ line but on i686-linux (or x86_64-linux with -m32) on the : step0_jumps[' ']; line. I think the difference is due to a useless cast missing on the latter (int and __PTRDIFF_TYPE__ are either the same or uselessly compatible, so there is no extra cast stmt which holds some particular location). On lp64 the above is (int)(__print_buffer_spec ? &&do_form_unknown - &&do_form_unknown : (__PTRDIFF_TYPE__) step0_jumps[' ']); So, either we would need to expect this dg-warning for say lp64 only and expect a dg-warning on the other line for ilp32 (but what to do for non-lp64/ilp32 targets?), or limit the test to lp64 only, or the following patch just forces it onto one line (we regularly go over the 80 line limit in the testsuite, often by a lot) and then it really doesn't matter on which column the warning is emitted. Tested on x86_64-linux and i686-linux by making sure the pre r16-8019 still ICEd on it (both 64-bit and 32-bit) and that latest trunk warns on the right line with both. 2026-03-13 Jakub Jelinek PR analyzer/124375 * gcc.dg/analyzer/ice-pr124375-1.c (__printf_buffer): Put the whole ?: expression on a single line. --- diff --git a/gcc/testsuite/gcc.dg/analyzer/ice-pr124375-1.c b/gcc/testsuite/gcc.dg/analyzer/ice-pr124375-1.c index 537f51345a4..3c1eac18dfe 100644 --- a/gcc/testsuite/gcc.dg/analyzer/ice-pr124375-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/ice-pr124375-1.c @@ -6,9 +6,8 @@ void *__printf_buffer_ptr; void __printf_buffer() { int step0_jumps[] = {&&do_flag_hash - &&do_form_unknown}; do_flag_hash: - __printf_buffer_offset = __printf_buffer_spec /* { dg-warning "stack-based buffer over-read" } */ - ? &&do_form_unknown - &&do_form_unknown - : step0_jumps[' ']; + __printf_buffer_offset + = __printf_buffer_spec ? &&do_form_unknown - &&do_form_unknown : step0_jumps[' ']; /* { dg-warning "stack-based buffer over-read" } */ __printf_buffer_ptr = &&do_form_unknown + __printf_buffer_offset; goto *__printf_buffer_ptr; do_form_unknown: