From: Jozef Lawrynowicz Date: Tue, 29 Aug 2017 13:20:54 +0000 (+0000) Subject: re PR target/80993 ([msp430] __attribute__((interrupt)) should imply __attribute__... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10bcba61fcfb0cd7f7a2ba64f1a14c62e3512eca;p=gcc.git re PR target/80993 ([msp430] __attribute__((interrupt)) should imply __attribute__((used))) PR target/80993 * gcc/config/msp430/msp430.c (msp430_attr): Mark interrupt handlers as used. From-SVN: r251410 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0002ce1ff48..951e6e8fd9c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-08-29 Jozef Lawrynowicz + + PR target/80993 + * gcc/config/msp430/msp430.c (msp430_attr): Mark interrupt + handlers as used. + 2017-08-29 Richard Biener * dwarf2out.c (add_dwarf_attr): When checking is enabled verify diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 2b4427d8eb2..48fc12d9a91 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1904,6 +1904,10 @@ msp430_attr (tree * node, if (! TREE_PUBLIC (* node)) message = "interrupt handlers cannot be static"; + + /* Ensure interrupt handlers never get optimised out. */ + TREE_USED (* node) = 1; + DECL_PRESERVE_P (* node) = 1; } else if (TREE_NAME_EQ (name, ATTR_REENT)) { diff --git a/gcc/testsuite/gcc.target/msp430/pr80993.c b/gcc/testsuite/gcc.target/msp430/pr80993.c new file mode 100644 index 00000000000..4da5cf95532 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/pr80993.c @@ -0,0 +1,13 @@ +/* { dg-do link } */ +/* { dg-options "--save-temps -msim -flto -Os" } */ +/* { dg-final { scan-file "pr80993.exe.ltrans0.s" no_ref_handler } } */ + +void __attribute__((interrupt)) no_ref_handler (void) +{ + while (1); +} + +int main (void) +{ + return 0; +}