From: Senthil Kumar Selvaraj Date: Wed, 10 Aug 2016 12:35:57 +0000 (+0000) Subject: Fix PR 71873 - ICE in push_reload X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5250a5bbb098b302d251aaa116bc15f50e15c4c8;p=gcc.git Fix PR 71873 - ICE in push_reload Extend computation of subreg_in_class to constants and plus expressions inside SUBREGs, before recursively calling push_reload. SYMBOL_REFs are also CONSTANT_P, so remove explicit handling of SYMBOL_REFs. gcc/ChangeLog PR target/71873 * reload.c (push_reload): Compute subreg_in_class for subregs of constants and plus expressions. Remove special handling of SYMBOL_REFs. gcc/testsuite/ChangeLog PR target/71873 * gcc.target/avr/pr71873.c: New test. From-SVN: r239321 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b8cbc7ad2f..17fa9faa002 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-08-10 Senthil Kumar Selvaraj + + PR target/71873 + * reload.c (push_reload): Compute subreg_in_class for + subregs of constants and plus expressions. Remove special + handling of SYMBOL_REFs. + 2016-08-10 Alan Modra PR target/71680 diff --git a/gcc/reload.c b/gcc/reload.c index 1945133baf6..afdd56dfeca 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -1141,7 +1141,8 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc, SUBREG_BYTE (in), GET_MODE (in)), REGNO (SUBREG_REG (in))); - else if (GET_CODE (SUBREG_REG (in)) == SYMBOL_REF) + else if (CONSTANT_P (SUBREG_REG (in)) + || GET_CODE (SUBREG_REG (in)) == PLUS) subreg_in_class = find_valid_class_1 (inmode, GET_MODE (SUBREG_REG (in)), rclass); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f1465e878b9..c9a4eedfb26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-10 Senthil Kumar Selvaraj + + PR target/71873 + * gcc.target/avr/pr71873.c: New test. + 2016-08-09 Martin Liska * g++.dg/gcov/gcov-dump-1.C: New test. diff --git a/gcc/testsuite/gcc.target/avr/pr71873.c b/gcc/testsuite/gcc.target/avr/pr71873.c new file mode 100644 index 00000000000..0791d921a42 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr71873.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fcaller-saves" } */ + +#include + +typedef struct { + uint8_t x; + uint32_t y; +} A; + +A a; + +extern int bar(int); +extern int foo (char *s, ...); + +extern uint8_t param; +extern uint8_t h,m,s,ld,lm; +extern uint16_t d; + +void gps_parse_string(int z) +{ + while (bar(z)) + { + switch (param) + { + case 0: foo("a", &h, &m, &s, &d); break; + case 1: foo("d", &ld, &lm, &a.y); break; + } + } +}