Changeset 16d9c3a


Ignore:
Timestamp:
May 1, 2026, 2:43:09 PM (3 hours ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
fc9d167
Parents:
efa8439a
Message:

Strengthen a test that had been evading warnings on 64-bit only.

This test change is expected to break the 64-bit build (to match currently-broken 32-bit). A subsequet test change is expected to fix both builds.

This change makes a test, which was incorrectly architecture-specific, into one that is architecture-independent.

Test is: array-collections/c_dependent.

The relevant array-size warning occurs in gcc-11+ (new-gcc).

The test had been passing on 64-bit only because of a quirk: new-gcc's dependent warning gives false accept when a dimension expression is complex enough; CFA's (arch-specific) inserted casts interacted with an incidental choice of the test program, as follows:

original
void fbound_ptr_allow( int n, float a[n] );
source
void f
bound_ptr_allow( int n, float a[(unsigned long int) n] ); 64-bit lowering => different enough type, check skipped
void fbound_ptr_allow( int n, float a[(unsigned int) n] );
32-bit lowering => close enough type, check enforced

this change's revision
void fbound_ptr_allow( size_t n, float a[n] );
source
void f
bound_ptr_allow( unsigned long int n, float a[(unsigned long int) n] ); 64-bit lowering => close enough type, check enforced
void fbound_ptr_allow( unsigned int n, float a[(unsigned int) n] );
32-bit lowering => close enough type, check enforced

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/array-collections/c-dependent.cfa

    refa8439a r16d9c3a  
    55}
    66
    7 void f__bound_ptr_allow( int n, float a[n] ) {
    8     printf( "bound_ptr_allow %d: %.1f %.1f %.1f\n", n, a[0], a[1], a[2] );
     7void f__bound_ptr_allow( size_t n, float a[n] ) {
     8    printf( "bound_ptr_allow %zd: %.1f %.1f %.1f\n", n, a[0], a[1], a[2] );
    99}
    1010void bound_ptr_allow() {
     
    1414}
    1515
    16 void f__bound_ar_allow( int n, float a[][n + 1] ) {
    17     printf( "bound_ar_allow %d:\n", n );
     16void f__bound_ar_allow( size_t n, float a[][n + 1] ) {
     17    printf( "bound_ar_allow %zd:\n", n );
    1818    printf( "%.1f %.1f %.1f\n", a[0][0], a[0][1], a[0][2] );
    1919    printf( "%.1f %.1f %.1f\n", a[1][0], a[1][1], a[1][2] );
Note: See TracChangeset for help on using the changeset viewer.