https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107842

            Bug ID: 107842
           Summary: [avr] Set --param=min-pagesize=0 in the backend
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

The AVR backend should set --param=min-pagesize=0 in v12+, or otherwise we will
see warnings for each and every SFR access like:

typedef __UINT8_TYPE__ uint8_t;

#define SREG (*(volatile uint8_t*) (0x3F + __AVR_SFR_OFFSET__ ))

void bar (void)
{
    SREG = 0;
}

> avr-gcc -c foo-i.c -mmcu=atmega8 -Os -Wall
foo-i.c: In function 'bar':
foo-i.c:7:6: warning: array subscript 0 is outside array bounds of 'volatile
uint8_t[0]' {aka 'volatile unsigned char[]'} [-Warray-bounds]
    7 |     SREG = 0;
      |     ~^~~~~~~~

Reply via email to