Debian Codegraph @

gcc/testsuite/gcc.target/avr/torture/pr112944-flmap-1.c

raw
1 /* { dg-do run } */
2 /* { dg-additional-options "-Wl,--defsym,__flmap=1" } */
3
4 const int val = 1234;
5
6 #ifdef __AVR_HAVE_FLMAP__
7 /* Initialize NVMCTRL_CTRLB.FLMAP to __flmap. */
8 #include <avr/io.h>
9 __attribute__((naked, section(".init2")))
10 __attribute__((used, unused, no_instrument_function))
11 static void init_flmap (void)
12 {
13 uint8_t ctrlb = NVMCTRL_CTRLB;
14 ctrlb &= ~ NVMCTRL_FLMAP_gm;
15 ctrlb |= 1 << NVMCTRL_FLMAP_gp;
16 NVMCTRL_CTRLB = ctrlb;
17 }
18 #endif
19
20 int main (void)
21 {
22 const int *p = & val;
23 __asm ("" : "+r" (p));
24
25 if (*p != 1234)
26 __builtin_abort ();
27
28 return 0;
29 }