Message ID | 5ece33f1-c51b-2cda-3a47-711652835b11@suse.cz |
---|---|
State | New |
Headers | show |
Series | Fix use-after-scope error. | expand |
On Wed, Oct 11, 2017 at 08:17:25AM +0200, Martin Liška wrote: > One can see use-after-scope error in boostrap-asan: > > gcc/ChangeLog: > > 2017-10-10 Martin Liska <mliska@suse.cz> > > * print-rtl.c (print_insn): Move declaration of idbuf > to same scope as name. > --- > gcc/print-rtl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > > diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c > index 79ec463df45..28d99862cad 100644 > --- a/gcc/print-rtl.c > +++ b/gcc/print-rtl.c > @@ -1792,11 +1792,11 @@ print_insn (pretty_printer *pp, const rtx_insn *x, int verbose) > case DEBUG_INSN: > { > const char *name = "?"; > + char idbuf[32]; > > if (DECL_P (INSN_VAR_LOCATION_DECL (x))) > { > tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x)); > - char idbuf[32]; > if (id) > name = IDENTIFIER_POINTER (id); > else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x)) Ok. This should IMHO go into release branches too. Jakub
On 10/11/2017 09:15 AM, Jakub Jelinek wrote: > On Wed, Oct 11, 2017 at 08:17:25AM +0200, Martin Liška wrote: >> One can see use-after-scope error in boostrap-asan: >> >> gcc/ChangeLog: >> >> 2017-10-10 Martin Liska <mliska@suse.cz> >> >> * print-rtl.c (print_insn): Move declaration of idbuf >> to same scope as name. >> --- >> gcc/print-rtl.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> > >> diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c >> index 79ec463df45..28d99862cad 100644 >> --- a/gcc/print-rtl.c >> +++ b/gcc/print-rtl.c >> @@ -1792,11 +1792,11 @@ print_insn (pretty_printer *pp, const rtx_insn *x, int verbose) >> case DEBUG_INSN: >> { >> const char *name = "?"; >> + char idbuf[32]; >> >> if (DECL_P (INSN_VAR_LOCATION_DECL (x))) >> { >> tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x)); >> - char idbuf[32]; >> if (id) >> name = IDENTIFIER_POINTER (id); >> else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x)) > > Ok. This should IMHO go into release branches too. Yes, will do that. Martin > > Jakub >
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 79ec463df45..28d99862cad 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -1792,11 +1792,11 @@ print_insn (pretty_printer *pp, const rtx_insn *x, int verbose) case DEBUG_INSN: { const char *name = "?"; + char idbuf[32]; if (DECL_P (INSN_VAR_LOCATION_DECL (x))) { tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x)); - char idbuf[32]; if (id) name = IDENTIFIER_POINTER (id); else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x))