Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Harald Anlauf
> Thanks. Though, see Andreas' mail, I think he is right that there is really > no reason to have that dt_name local buffer at all, just changing > dt_name from an array to const char *dt_name; and changing the strcpy to > dt_name = "STAR"; > and the former strncpy (dt_name, ...) to > dt_name = gf

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Jakub Jelinek via Gcc-patches
On Sat, May 30, 2020 at 09:11:23PM +0200, Jakub Jelinek via Gcc-patches wrote: > There is a possible buffer overflow in the string with or without that > change but to fix that I think it would be desirable to pass not just the > string buffer to the function but also the length of the buffer and i

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Jakub Jelinek via Gcc-patches
On Sat, May 30, 2020 at 08:57:46PM +0200, Harald Anlauf wrote: > > That is detecting it after the buffer overflow has happened already, that is > > too late, after UB anything can happen. > > +{ > > + const char *upper = gfc_dt_upper_string (derived->name); > > + size_t len = strnlen

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Harald Anlauf
> That is detecting it after the buffer overflow has happened already, that is > too late, after UB anything can happen. > +{ > + const char *upper = gfc_dt_upper_string (derived->name); > + size_t len = strnlen (upper, sizeof (dt_name)); > + gcc_assert (len < sizeof (dt_name));

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Andreas Schwab
On Mai 30 2020, Harald Anlauf wrote: > diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c > index db395624a16..6d0924da2b8 100644 > --- a/gcc/fortran/class.c > +++ b/gcc/fortran/class.c > @@ -484,7 +484,12 @@ get_unique_type_string (char *string, gfc_symbol > *derived) >if (derived->attr.

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Jakub Jelinek via Gcc-patches
On Sat, May 30, 2020 at 02:48:32PM +0200, Harald Anlauf wrote: > I'ld like to detect the situation that when somebody modifies name-mangling in > a way that generates a buffer overrun during regtesting so that the > temporaries > to adjust are easier to find. > > After thinking about your and H.J

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-30 Thread Harald Anlauf
> > > This breaks bootstrap: > > > > > > https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072642.html > > > > > > ../../src-master/gcc/fortran/class.c:487:13: error: ‘char* > > > strncpy(char*, const char*, size_t)’ specified bound 67 equals > > > destination size [-Werror=stringop-truncatio

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-29 Thread Jakub Jelinek via Gcc-patches
On Sat, May 30, 2020 at 12:20:19AM +0200, Harald Anlauf wrote: > > Gesendet: Freitag, 29. Mai 2020 um 23:57 Uhr > > Von: "H.J. Lu" > > > This breaks bootstrap: > > > > https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072642.html > > > > ../../src-master/gcc/fortran/class.c:487:13: error: ‘

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-29 Thread H.J. Lu via Gcc-patches
On Fri, May 29, 2020 at 3:20 PM Harald Anlauf wrote: > > Hi H.J., > > > Gesendet: Freitag, 29. Mai 2020 um 23:57 Uhr > > Von: "H.J. Lu" > > > This breaks bootstrap: > > > > https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072642.html > > > > ../../src-master/gcc/fortran/class.c:487:13: error

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-29 Thread Harald Anlauf
Hi H.J., > Gesendet: Freitag, 29. Mai 2020 um 23:57 Uhr > Von: "H.J. Lu" > This breaks bootstrap: > > https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072642.html > > ../../src-master/gcc/fortran/class.c:487:13: error: ‘char* > strncpy(char*, const char*, size_t)’ specified bound 67 equal

Re: [PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-29 Thread H.J. Lu via Gcc-patches
On Fri, May 29, 2020 at 1:39 PM Harald Anlauf wrote: > > The initial patch for this PR had some fallout which for unknown reason > did only show up on i686, but not on x86_64. With initial guidance by > Manfred Schwarb three further locations exhibiting buffer overrun could > be identified in a g

[PATCH, committed, part2] PR fortran/95090 - ICE: identifier overflow

2020-05-29 Thread Harald Anlauf
The initial patch for this PR had some fallout which for unknown reason did only show up on i686, but not on x86_64. With initial guidance by Manfred Schwarb three further locations exhibiting buffer overrun could be identified in a gdb session and were fixed. Committed as 'obvious' to master. T