public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: David Brown <david.brown@hesbynett.no>
Cc: gcc@gcc.gnu.org
Subject: Re: More C type errors by default for GCC 14
Date: Thu, 11 May 2023 10:39:37 +0300	[thread overview]
Message-ID: <83ttwj5nba.fsf@gnu.org> (raw)
In-Reply-To: <u3i3ak$3qs$1@ciao.gmane.io> (message from David Brown on Thu, 11 May 2023 08:52:03 +0200)

> From: David Brown <david.brown@hesbynett.no>
> Date: Thu, 11 May 2023 08:52:03 +0200
> 
> > But we are not talking about some random code that just happened to
> > slip through cracks as a side effect of the particular implementation.
> > We are talking about code that was perfectly valid, had well-defined
> > semantics, and produced a working program.  I don't care about the
> > former; I do care about the latter.
> 
> How would you know that the code had perfectly valid, well-defined 
> semantics?

The programmer who wants to keep that code will know (or at least
he/she should).

> I've had the dubious pleasure of trying to maintain and update code 
> where the previous developer had a total disregard for things like 
> function declaration - he really did dismiss compiler complaints about 
> implicit function declarations as "only a warning".  The program worked 
> as he expected, for the most part.  But that was despite many functions 
> being defined in one part of the code with one set of parameters (number 
> and type), and called elsewhere with a different set - sometimes more 
> than one selection of parameter types in the same C file.

In this situation, where you take responsibility of a program someone
else wrote, and consider its code to be badly or unsafely written, TRT
is to modify the program to use more modern techniques that you
understand and support.  Compiler warnings and your own knowledge of
valid C will guide you in this.

My problem is not with the situation you described, it's with a case
that the "previous" maintainer remains the current maintainer, and/or
for some reason rewriting the code is either impractical or not the
best alternative for other reasons.

> If a compiler is required to continue to compile every program that a 
> previous version compiled, where the developer was satisfied that the 
> program worked as expected, then the only way to guarantee that is to 
> stop changing and improving gcc.

There should be no such requirement.  If addition of new features or
support for the evolving standards mean GCC must break old UB-style
code, that is fully justified and understandable.  What is _not_
justified, IMO, is breaking old programs without any such technical
reasons, just because we think they are better off broken.  IOW, as
long as being able to compile those old programs in the same old way
doesn't get in the way of being able to compile valid programs, the
old code should remain unbroken.

> I agree that accepting fully correct programs written in K&R C would not 
> limit the future development of gcc.  But how many programs written in 
> K&R C, big enough and important enough to be relevant today, are fully 
> correct?  I'd be surprised if you needed more than one hand to count 
> them.

For the purpose of this discussion, the "how many" question is not
interesting.  If there is an incorrect K&R program, the results and
consequences of this incorrectness are on the maintainers of those
programs, not on the GCC team.  If some of those incorrect programs
break because of some valid development in GCC, so be it.

But the decision to make a warning to be an error is not dictated by
GCC development and its needs to compile valid programs, it is
dictated by other, largely non-technical considerations.  I'm saying
that these considerations are not reasons good enough for breaking
those old programs.

> Continuing to give developers what they expect, rather than what the 
> standards (and gcc extensions) guarantee, is always an issue for 
> backwards compatibility.  Each new version of gcc can, and sometimes 
> does, "break" old code - code that people relied on before, but was 
> actually incorrect.  This is unavoidable if gcc is to progress.

It is indeed unavoidable, and a fact of life.  All I'm saying is that
we as developers should try to minimize these breakages as much as
possible, without hampering new developments too much.

> That is why I suggested that a flag such as "-fold-code" that enables 
> long outdated syntaxes should also disable the kind of optimisations 
> that are most likely to cause issues with old code, and should enable 
> semantics chances to match likely assumptions in such code.  I don't 
> believe in the existence of correct K&R C code - but I /do/ believe in 
> the importance of some K&R C code despite its errors.

The problem, as you well know, is that when a large software package
fails to build, it is not immediately clear what is the reason for
that.  We here discuss a single such reason, but in reality no one
tells you that the build fails because the new version of GCC now
rejects code it accepted in the previous version.  The upgrade that
installed the new GCC will typically update dozens of other system
components, many of which could be the culprit.  Just understanding
that the reason is GCC and its rejection of certain constructs is a
job that can take hours full of frustration and hair-pulling.  This is
what I think we as developers need to avoid as much as possible.  Once
you understand the reason, fixing it with a compiler switch might be
relatively simple, at least in many cases, but the problem is the
effort it takes to realize that the option is all you need.  There are
no good ways of making that option discoverable enough to make this
process significantly easier.

> "Knowing what you are talking about" is not the same thing as being 
> correct.  But I think our key disagreements here are a matter of 
> opinion, not fact - "correct" is not an appropriate term for an opinion. 
>   We are looking at things from a different viewpoint, which will 
> naturally be coloured by our experiences.  So to be clear, I fully 
> understand your opinion and viewpoint here - I just don't think it 
> should be the philosophy for gcc going forward.
> 
> It is a good thing that we can express and exchange these opinions. 
> Ultimately, I suppose it is the gcc steering committee that will decide 
> (the length of this thread suggests it is too important for developers 
> alone).  I don't know about you, but I know that /I/ have absolutely no 
> say or vote in the process - I am not involved in gcc development. 

Neither am I.  I'm investing my scarce time in this discussion in the
hope to convince the GCC development team and the steering committee
to see the downside of the proposal to reject those old programs where
GCC can still compile them without affecting modern valid C programs.
I think a warning is good enough in those case.

> However, I think it is good that a wide variety of people are able to 
> give their thoughts, ideas and opinions, and I hope it helps the people 
> who will make the decisions in the end.

Agreed.

  reply	other threads:[~2023-05-11  7:38 UTC|newest]

Thread overview: 246+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 12:15 Florian Weimer
2023-05-09 14:16 ` Dave Blanchard
2023-05-09 15:03 ` David Edelsohn
2023-05-09 15:07   ` Sam James
2023-05-09 15:35     ` Dave Blanchard
2023-05-09 15:58       ` Jonathan Wakely
2023-05-09 16:26       ` Arsen Arsenović
2023-05-09 15:14   ` Jonathan Wakely
2023-05-09 15:22     ` Dave Blanchard
2023-05-09 16:38       ` Arsen Arsenović
2023-05-09 16:57         ` Eli Zaretskii
2023-05-09 17:05           ` Sam James
2023-05-09 18:55             ` Eli Zaretskii
2023-05-09 17:15           ` Jonathan Wakely
2023-05-09 19:04             ` Eli Zaretskii
2023-05-09 19:07               ` Jakub Jelinek
2023-05-09 19:22                 ` Eli Zaretskii
2023-05-09 20:13                   ` David Edelsohn
2023-05-09 20:21                     ` Arsen Arsenović
2023-05-10  2:38                       ` Eli Zaretskii
2023-05-10  8:36                         ` Arsen Arsenović
2023-05-10 11:52                           ` Eli Zaretskii
2023-05-10 11:56                             ` Jonathan Wakely
2023-05-10 12:25                               ` Eli Zaretskii
2023-05-10 12:30                                 ` Jonathan Wakely
2023-05-10 12:44                                   ` Eli Zaretskii
2023-05-15 12:28                         ` Richard Earnshaw (lists)
2023-05-15 20:17                           ` Eric Gallager
2023-05-16  7:05                             ` Florian Weimer
2023-05-16 15:56                               ` Jason Merrill
2023-05-09 20:40                     ` Jonathan Wakely
2023-05-09 22:27                       ` David Edelsohn
2023-05-09 22:37                         ` Joel Sherrill
2023-05-09 22:45                           ` Jonathan Wakely
2023-05-10 10:40                             ` Eric Gallager
2023-05-10 10:45                               ` Sam James
2023-05-10 10:56                                 ` Neal Gompa
2023-05-10 12:06                                   ` Eli Zaretskii
2023-05-10 12:10                                     ` Neal Gompa
2023-05-10 12:41                                       ` Eli Zaretskii
2023-05-10 10:48                               ` Jonathan Wakely
2023-05-10 10:51                                 ` Jonathan Wakely
2023-05-10 12:00                               ` Eli Zaretskii
2023-05-10 12:42                                 ` Sam James
2023-05-10 15:10                             ` Joel Sherrill
2023-05-10 15:14                               ` Jakub Jelinek
2023-05-10 16:36                                 ` Joel Sherrill
2023-05-10 16:44                                   ` Jakub Jelinek
2023-05-10 17:05                                   ` Jonathan Wakely
2023-05-10 18:37                             ` James K. Lowden
2023-05-10 23:26                               ` Jonathan Wakely
2023-05-11 18:47                                 ` Jason Merrill
2023-05-10 23:33                               ` Sam James
2023-05-11  5:48                               ` Eli Zaretskii
2023-05-11  2:28                             ` Po Lu
2023-05-11  2:09                       ` Po Lu
2023-05-11  2:14                         ` Sam James
2023-05-11  2:23                           ` Po Lu
2023-05-11  3:14                             ` Eli Schwartz
2023-05-11  3:56                               ` Po Lu
2023-05-11  4:46                                 ` Eli Schwartz
2023-05-11  4:49                                   ` Eli Schwartz
2023-05-11  6:23                                     ` Po Lu
2023-05-11  6:18                                   ` Po Lu
2023-05-11 22:41                                     ` Eli Schwartz
2023-05-12  2:08                                       ` Po Lu
2023-05-12  3:07                                         ` Eli Schwartz
2023-05-12  5:57                                           ` Po Lu
2023-05-12 11:05                                             ` Gabriel Ravier
2023-05-12 13:53                                               ` Po Lu
2023-05-12 14:03                                                 ` Jonathan Wakely
2023-05-14 12:35                                                 ` Mark Wielaard
2023-05-12 11:48                                             ` Is the GNUC dialect anything that GCC does when given source code containing UB? (Was: More C type errors by default for GCC 14) Eli Schwartz
2023-05-12 13:07                                               ` Is the GNUC dialect anything that GCC does when given source code containing UB? Po Lu
2023-05-12  6:56                                           ` More C type errors by default for GCC 14 Eli Zaretskii
2023-05-12  7:28                                             ` Jonathan Wakely
2023-05-12 10:36                                               ` Eli Zaretskii
2023-05-12 13:19                                               ` Po Lu
2023-05-12 13:25                                                 ` Gabriel Ravier
2023-05-13  0:45                                                   ` Po Lu
2023-05-13  5:30                                                     ` Thomas Koenig
2023-05-13  5:53                                                       ` Po Lu
2023-05-14  5:10                                                         ` Eli Schwartz
2023-05-14  5:38                                                           ` Po Lu
2023-05-14  9:46                                                             ` David Brown
2023-05-14 10:21                                                               ` Jonathan Wakely
2023-05-14 10:23                                                                 ` Jonathan Wakely
2023-05-14  5:08                                                     ` Eli Schwartz
2023-05-14  5:28                                                       ` Po Lu
2023-05-14  5:56                                                         ` Eli Schwartz
2023-05-14 11:55                                                           ` Po Lu
2023-05-14 12:22                                                             ` Arsen Arsenović
2023-05-15  1:05                                                               ` Po Lu
2023-05-14  6:03                                                         ` Eli Schwartz
2023-05-14  8:47                                                         ` Jonathan Wakely
2023-05-14 12:05                                                           ` Po Lu
2023-05-14 12:48                                                             ` Nicholas Vinson
2023-05-14 10:29                                                         ` David Brown
2023-05-12 15:51                                                 ` Jason Merrill
2023-05-17 10:06                                                   ` Florian Weimer
2023-05-12 11:26                                         ` David Brown
2023-05-11  6:24                                   ` Eli Zaretskii
2023-05-11 22:43                                     ` Eli Schwartz
2023-05-12  2:38                                       ` Po Lu
2023-05-12  2:55                                         ` Jason Merrill
2023-05-12  6:01                                           ` Po Lu
2023-05-12  6:40                                             ` Jonathan Wakely
2023-05-12 13:23                                               ` Po Lu
2023-05-12 10:49                                             ` Pedro Alves
2023-05-12 13:26                                               ` Po Lu
2023-05-12 11:55                                             ` Eli Schwartz
2023-05-12 13:54                                               ` Po Lu
2023-05-12  6:49                                           ` Eli Zaretskii
2023-05-12  2:56                                         ` Sam James
2023-05-12  6:03                                           ` Po Lu
2023-05-12  3:06                                         ` Sam James
2023-05-12  6:25                                       ` Eli Zaretskii
2023-05-12 11:23                                         ` Gabriel Ravier
2023-05-11  6:12                               ` Eli Zaretskii
2023-05-11  7:04                                 ` Jonathan Wakely
2023-05-11 22:30                                 ` Eli Schwartz
2023-05-11 22:35                                   ` Sam James
2023-05-12  2:40                                     ` Po Lu
2023-05-12  2:52                                       ` Sam James
2023-05-12  5:32                                         ` Po Lu
2023-05-12  2:39                                   ` Po Lu
2023-05-12  3:18                                     ` Eli Schwartz
2023-05-12  6:17                                   ` Eli Zaretskii
2023-05-11  7:59                         ` David Brown
2023-05-09 21:00                     ` Thomas Koenig
2023-05-09 21:17                       ` Arsen Arsenović
2023-05-10 13:57                       ` Florian Weimer
2023-05-10 11:00                     ` David Brown
2023-05-11 10:49                       ` James K. Lowden
2023-05-11  1:38                     ` Po Lu
2023-05-11  1:43                       ` Sam James
2023-05-11  2:20                         ` Po Lu
2023-05-09 20:57                   ` Florian Weimer
2023-05-10  2:33                     ` Eli Zaretskii
2023-05-10  8:04                       ` Jonathan Wakely
2023-05-10  8:46                         ` Richard Biener
2023-05-10 12:26                           ` Florian Weimer
2023-05-10 11:30                         ` Eli Zaretskii
2023-05-10 12:03                           ` Jakub Jelinek
2023-05-10 12:36                             ` Eli Zaretskii
2023-05-10 12:41                               ` Gabriel Ravier
2023-05-10 14:14                                 ` Eli Zaretskii
2023-05-10 14:22                                   ` Jakub Jelinek
2023-05-10 15:30                                     ` Eli Zaretskii
2023-05-10 16:02                                       ` Jakub Jelinek
2023-05-10 16:31                                         ` Eli Zaretskii
2023-05-10 16:33                                           ` Richard Biener
2023-05-10 16:57                                             ` Eli Zaretskii
2023-05-10 17:08                                           ` Joseph Myers
2023-05-10 18:18                                             ` Eli Zaretskii
2023-05-12 15:02                                             ` Florian Weimer
2023-05-12 17:52                                               ` Florian Weimer
2023-05-12 17:55                                                 ` Gabriel Ravier
2023-05-12 18:00                                                   ` Florian Weimer
2023-05-12 18:08                                                   ` Alexander Monakov
2023-05-12 18:14                                                     ` Florian Weimer
2023-05-15 12:51                                                       ` Michael Matz
2023-05-16  8:55                                                         ` Florian Weimer
2023-05-16 10:39                                                           ` Alexander Monakov
2023-05-16 11:01                                                             ` Jakub Jelinek
2023-05-16 11:09                                                               ` Jonathan Wakely
2023-05-16 11:15                                                               ` Florian Weimer
2023-05-12 19:44                                               ` Joseph Myers
2023-05-12 20:43                                                 ` Florian Weimer
2023-05-12 20:18                                               ` Jason Merrill
2023-05-12 20:57                                                 ` Florian Weimer
2023-05-12 21:20                                                   ` Sam James
2023-05-12 21:21                                               ` Sam James
2023-05-12 21:37                                                 ` Florian Weimer
2023-05-12 21:47                                                   ` Sam James
2023-05-12 21:59                                                     ` Florian Weimer
2023-05-10 15:58                                   ` David Brown
2023-05-10 16:28                                     ` Eli Zaretskii
2023-05-11  6:52                                       ` David Brown
2023-05-11  7:39                                         ` Eli Zaretskii [this message]
2023-05-10 14:31                             ` Thomas Koenig
2023-05-10 15:37                               ` Eli Zaretskii
2023-05-11  2:38                         ` Po Lu
2023-05-11  7:38                           ` Arsen Arsenović
2023-05-11  8:31                             ` Po Lu
2023-05-11  8:44                               ` Arsen Arsenović
2023-05-11  9:28                                 ` Po Lu
2023-05-11 21:10                                   ` Arsen Arsenović
2023-05-12  1:41                                     ` Po Lu
2023-05-11 10:35                                 ` Eli Zaretskii
2023-05-11 19:25                                   ` Arsen Arsenović
2023-05-12  2:36                                     ` Po Lu
2023-05-12 12:30                                       ` Gabriel Ravier
2023-05-12 13:56                                         ` Po Lu
2023-05-12  7:53                                     ` Eli Zaretskii
2023-05-12  8:15                                       ` Jakub Jelinek
2023-05-12 10:40                                         ` Eli Zaretskii
2023-05-12  8:45                                       ` Christian Groessler
2023-05-12 10:14                                         ` Jonathan Wakely
2023-05-12  9:11                                       ` Thomas Koenig
2023-05-11  8:53                               ` Jonathan Wakely
2023-05-11  9:29                                 ` Po Lu
2023-05-10  8:49               ` David Brown
2023-05-10 11:37                 ` Eli Zaretskii
2023-05-10 11:49                   ` Jonathan Wakely
2023-05-10 12:22                     ` Eli Zaretskii
2023-05-10 13:30                       ` David Brown
2023-05-10 14:39                         ` Eli Zaretskii
2023-05-10 15:21                           ` Paul Koning
2023-05-10 16:20                           ` David Brown
2023-05-10 16:48                             ` Eli Zaretskii
2023-05-10 12:32                   ` Sam James
2023-05-10 12:47                     ` Eli Zaretskii
2023-05-09 19:33           ` Arsen Arsenović
2023-05-09 15:25     ` David Edelsohn
2023-05-11  1:25     ` Po Lu
2023-05-11  1:30       ` Sam James
2023-05-11  1:33       ` Sam James
2023-05-11  2:18         ` Po Lu
2023-05-11  6:44           ` Jonathan Wakely
2023-05-11  8:32             ` Po Lu
2023-05-11  8:52               ` Jonathan Wakely
2023-05-11  7:36       ` Arsen Arsenović
2023-05-11  8:23         ` Po Lu
2023-05-09 18:22   ` Florian Weimer
2023-05-11 21:32     ` Segher Boessenkool
2023-05-09 15:16 ` Richard Biener
2023-05-09 16:05   ` Jakub Jelinek
2023-05-09 16:11     ` Sam James
2023-05-09 16:13     ` David Edelsohn
     [not found]       ` <BBE9950C-28AA-4A1C-A4C5-7F486538004E@gmail.com>
2023-05-09 16:44         ` Florian Weimer
2023-05-09 16:58           ` Ian Lance Taylor
2023-05-09 17:08           ` Jason Merrill
2023-05-09 17:16             ` Sam James
2023-05-09 16:59   ` Florian Weimer
2023-05-09 17:07     ` Sam James
2023-05-09 17:35       ` Florian Weimer
2023-05-11 15:21 ` Peter0x44
2023-05-12  9:33 ` Martin Jambor
2023-05-12 12:30   ` Jakub Jelinek
2023-05-15 12:46     ` Michael Matz
2023-05-15 13:14     ` Richard Earnshaw (lists)
2023-05-10 12:41 Marcin Jaczewski
2023-05-10 14:19 ` Eli Zaretskii
2023-05-10 13:10 Basile Starynkevitch
2023-05-10 14:20 ` David Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ttwj5nba.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=david.brown@hesbynett.no \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).