[bug #60798] Make does not compile with GCC 11.1.0

2021-12-19 Thread Paul D. Smith
Update of bug #60798 (project make): Status:None => Fixed Assigned to:None => psmith Open/Closed:Open => Closed Fixed Release:

[bug #60798] Make does not compile with GCC 11.1.0

2021-12-04 Thread Jouke Witteveen
Additional Item Attachment, bug #60798 (project make): File name: SV-60798-Rework-to-silence-GCC11-warning.patch Size:3 KB ___ Reply to

[bug #60798] Make does not compile with GCC 11.1.0

2021-12-04 Thread Jouke Witteveen
Follow-up Comment #4, bug #60798 (project make): As a sort of exercise, I got rid of the final warning too. This required some moving code around and I duplicated the `strchr` call and the `p[-1] != '\\'` test. Let me know if these changes make any sense. While at it, I also added an update to

[bug #60798] Make does not compile with GCC 11.1.0

2021-12-03 Thread Jouke Witteveen
Follow-up Comment #3, bug #60798 (project make): I expanded the patch a bit to also silence a _maybe-uninitialized_ error. With GCC11, there is now only one warning remaining, which is the _return-local-addr_ warning in src/read.c:2534 (find_percent_cached). The code is correct, but GCC fails to

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-12-03 Thread Jouke Witteveen
On Fri, Dec 3, 2021 at 1:26 PM Edward Welbourne wrote: > > Jouke Witteveen (3 December 2021 13:22) wrote: > > The next warning I get (GCC11) is a _return-local-addr_ warning in > > src/read.c:2534 (find_percent_cached). Maybe GCC doesn't recognize alloca > > as a > > heap allocation? Just

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-12-03 Thread Edward Welbourne
Jouke Witteveen (3 December 2021 13:22) wrote: > The next warning I get (GCC11) is a _return-local-addr_ warning in > src/read.c:2534 (find_percent_cached). Maybe GCC doesn't recognize alloca as a > heap allocation? Just guessing; this warning was not obvious to me. alloca() is not a heap

[bug #60798] Make does not compile with GCC 11.1.0

2021-12-03 Thread Jouke Witteveen
Follow-up Comment #2, bug #60798 (project make): I couldn't find any signs of GCC becoming clever enough to detect why this code is correct. Minor code changes can silence the _stringop-overflow_ warnings. The next warning I get (GCC11) is a _return-local-addr_ warning in src/read.c:2534

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-21 Thread RANDRIANAINA Georges Aaron
It gives the same error: src/main.c:1954:16: error: writes 1 byte in a region of size 0 [-Werror=stringop-overflow=] 1954 |   *(p - 1) = '\0'; |   ~^~ Le 21/06/2021 à 16:12, David A. Wheeler a écrit :  p[-1] = '\0'; Is this just a style warning being turned into

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-21 Thread David A. Wheeler
>> p[-1] = '\0'; Is this just a style warning being turned into an error? That is, would this compile if the line was rewritten as: *(p - 1) = ‘\0’; Which means the same thing per the spec? If the rewrite would fix it, I suggest doing the rewrite, to reduce compilation problems. ---

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-21 Thread Andreas Schwab
On Jun 19 2021, Paul Smith wrote: > But, as human programmers we can examine this code and understand that > actually, it's never possible for p to point to the first character of > the array: we know that eval_strings->idx is never 0, so we know that p > will always be incremented past the

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Paul Smith
On Sat, 2021-06-19 at 16:23 +0100, Dmitrii Pasechnik wrote: > > I don't think I understand. > > p[] occupies a continuous memory area, starting from p[0], but p[-1] > is not guaranteed by the standard to be accessible for you (well, > unless you control the memory layout by placing p in a struct,

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Eli Zaretskii
> Date: Sat, 19 Jun 2021 16:40:08 +0100 > From: Dmitrii Pasechnik > Cc: bo...@kolpackov.net, bug-make > > Compiler does not guarantee you that doing something with p[-1] > is not going to end in a segfault. It's hack, as it just happens to work, but > YMMV. > > E.g. clang 10, or Apple's clang

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Dmitrii Pasechnik
On Sat, Jun 19, 2021 at 11:10:14AM -0400, Dmitry Goncharov wrote: > On Sat, Jun 19, 2021 at 10:31 AM Dmitrii Pasechnik > wrote: > > It's undefined behaviour in C to point to such a location, isn't it? > > Is this hack really needed? > > There is no hack. It is pointer arithmetic in c. p[-1] is

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Dmitrii Pasechnik
On Sat, Jun 19, 2021 at 10:52:41AM -0400, Paul Smith wrote: > On Sat, 2021-06-19 at 15:31 +0100, Dmitrii Pasechnik wrote: > > On Fri, Jun 18, 2021 at 12:53:32PM -0400, Paul D. Smith wrote: > > > > > Follow-up Comment #1, bug #60798 (project make): > > > FWIW, this warning is not valid in this

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Dmitry Goncharov via Bug reports and discussion for GNU make
On Sat, Jun 19, 2021 at 10:31 AM Dmitrii Pasechnik wrote: > It's undefined behaviour in C to point to such a location, isn't it? > Is this hack really needed? There is no hack. It is pointer arithmetic in c. p[-1] is the same as *(p-1). regards, Dmitry

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Eli Zaretskii
> From: Paul Smith > Date: Sat, 19 Jun 2021 10:52:41 -0400 > Cc: bug-make@gnu.org > > On Sat, 2021-06-19 at 15:31 +0100, Dmitrii Pasechnik wrote: > > On Fri, Jun 18, 2021 at 12:53:32PM -0400, Paul D. Smith wrote: > > > > > Follow-up Comment #1, bug #60798 (project make): > > > FWIW, this

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Paul Smith
On Sat, 2021-06-19 at 15:31 +0100, Dmitrii Pasechnik wrote: > On Fri, Jun 18, 2021 at 12:53:32PM -0400, Paul D. Smith wrote: > > > Follow-up Comment #1, bug #60798 (project make): > > FWIW, this warning is not valid in this situation. The code is > > correct; p will always be pointing into a

Re: [bug #60798] Make does not compile with GCC 11.1.0

2021-06-19 Thread Dmitrii Pasechnik
On Fri, Jun 18, 2021 at 12:53:32PM -0400, Paul D. Smith wrote: > Follow-up Comment #1, bug #60798 (project make): > > FWIW, this warning is not valid in this situation. The code is correct; p > will always be pointing into a valid buffer and never pointing at the first > character in that

[bug #60798] Make does not compile with GCC 11.1.0

2021-06-18 Thread Paul D. Smith
Follow-up Comment #1, bug #60798 (project make): FWIW, this warning is not valid in this situation. The code is correct; p will always be pointing into a valid buffer and never pointing at the first character in that buffer, so p[-1] always points to valid memory. When building code for

[bug #60798] Make does not compile with GCC 11.1.0

2021-06-18 Thread anonyme
URL: Summary: Make does not compile with GCC 11.1.0 Project: make Submitted by: None Submitted on: ven. 18 juin 2021 16:36:51 UTC Severity: 3 - Normal Item Group: