tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: current gcc 12.4.0 bug



On Sat, Sep 28, 2024 at 01:24:39PM +1000, matthew green wrote:
> tlaronde%kergis.com@localhost writes:
> > I'm running current and stumbled on that:
> >
> > exec.c: In function 'shellexec':
> > exec.c:145:46: error: '%s' directive argument is null
> > [-Werror=format-overflow=]
> >   145 |         (void)fprintf(stderr, "do_qfilename (%s): %d\n",
> >       |                                              ^~
> > cc1: all warnings being treated as errors
> >
> > While the argument is not NULL.
> >
> > It's a bug in gcc see:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90036
> >
> > With this around, how can we be sure that the generated code is
> > correct?
> 
> looks like it's been a bug since GCC 8, and that the problem is
> a *missing* optimisation, so, i'd just go with ignoring it either
> with a -Wno- or going with "assert(foo)" before the fprintf(),
> as recommended in the above PR.
> 
> i can't get any of the examples in the PR to fail for me though,
> with GCC 10 or GCC 12 (both pkgsrc or gcc native.)
> 

I did get around with inserting an assert() as suggested in the bug report
above.

It's the analysis of the code that is incorrect so perhaps not the
produced code by itself. Nonetheless, it's uncomfortable (when one
doesn't know if he has to look for bugs in his code or in gcc)...
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index