(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
nios2/
pr92499-1.c
       1  /* PR target/92499 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -mgpopt=global -G8" } */
       4  
       5  /* Check placement and addressing of flexibly-sized objects with internal
       6     linkage.  */
       7  
       8  enum { size = 100 };
       9  
      10  struct flexible
      11  {
      12    int length;
      13    int data[];
      14  };
      15  
      16  static struct flexible local_flexible =
      17    {
      18      .data = { [size - 1] = 0, }
      19    };
      20  
      21  static struct flexible local_flexible_nonzero =
      22    {
      23      .length = size,
      24      .data = { [size - 1] = 0, }
      25    };
      26  
      27  struct flexible *
      28  get_local_flexible (void)
      29  {
      30    return &local_flexible;
      31  }
      32  
      33  struct flexible *
      34  get_local_flexible_nonzero (void)
      35  {
      36    return &local_flexible_nonzero;
      37  }
      38  
      39  /* We should not place the flexibly-sized objects in small data
      40     sections, or generate gp-relative addresses for them.  */
      41  
      42  /* { dg-final { scan-assembler-not "\\.sdata" } } */
      43  /* { dg-final { scan-assembler-not "\\.sbss" } } */
      44  /* { dg-final { scan-assembler-not "%gprel\(.*flexible.*\)" } } */
      45  
      46  
      47  
      48