public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eli Schwartz <eschwartz93@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: gcc@gcc.gnu.org
Subject: Is the GNUC dialect anything that GCC does when given source code containing UB? (Was: More C type errors by default for GCC 14)
Date: Fri, 12 May 2023 07:48:59 -0400	[thread overview]
Message-ID: <9fc58fad-5d2f-e288-ced5-83fb5813e7af@gmail.com> (raw)
In-Reply-To: <87h6si9jn0.fsf@yahoo.com>

On 5/12/23 1:57 AM, Po Lu wrote:
> Eli Schwartz <eschwartz93@gmail.com> writes:
>> It's still no big deal, no matter how much you dramatize the intensity
>> of adding a flag to your Makefiles.
> 
> It's extra work.  Why don't I just write:
> 
>   extern int foo ();
> 
> above each of the new errors?
> That is just about what anyone will do when confronted by these new
> errors.  As a result, you have not ensured that any declarations are
> correct, but instead you have annoyed a lot of people and lulled
> yourself into a false sense of safety.


Instead of adding one flag to their Makefile, which is too much work,
they will add *many* declarations of `extern int foo();` across many
source files in the same project?

Very interesting definition of burdensome work.

You keep saying "just about what anyone will do", but I do not believe
this is what anyone other than you will do.


> This document is the GCC manual, which makes reference (not too clearly,
> however, which should be fixed) to both implicit int and implicit
> function declarations, which are allowed in C99 and later dialects of C.
> 
> These constructs are not bugs.  These constructs explicitly defined by
> GNU C; since a diagnostic is issued, GNU C's implementation also
> conforms to the Standard.


You reading is faulty, and your beliefs about how software work are also
faulty, if you believe that the issuance of a diagnostic is what
constitutes adding new features to the language dialect called "GNU C".

Please start a new thread, titled something like "the documentation is
flawed, which should be fixed, because implicit function declarations
are referenced but not to clearly". Argue there, that implicit function
declarations should be documented on the "C Extensions" page.

Until everyone is on the same page as you about whether these are GNUC
extensions, this conversation will go nowhere.


>> You cannot, and are not permitted, to define "how GCC currently behaves"
>> as "defines what is valid GNU C". No one agrees with your analysis. Most
>                                     ^^^^^^
> 
> I'm not a person?


"no one agrees with you" is a common idiom that states that a person (in
this case Po Lu) holds an opinion that rest of the world (all persons
not named Po Lu) do not hold.

Since you cannot agree with yourself -- you are yourself -- I am forced
to believe that you are trolling by accusing me of denying you personhood.


>> importantly, GCC does not agree with your analysis.
> 
> For some definition of GCC, which is apparently you.


No, just the GCC manual.


>> It's a wild, wild, wild claim to begin with. You are arguing that any
>> bug, ANY bug whatsoever, which qualifies for the title "how GCC
>> currently behaves" because if a bug is currently present, then GCC
>> currently behaves in a buggy manner...
>>
>> ... any such bug is, ***because*** GCC currently does it, now part of
>> the documentation on "GNU C", a language dialect with documentation.
>>
>> Can you show me where on
>> https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html the GCC
>> documentation states that "C Extensions include anything that GCC
>> currently does, no matter what, no matter how documented or undocumented"?
> 
> I see:
> 
> `-Wno-implicit-int (C and Objective-C only)'
>      This option controls warnings when a declaration does not specify a
>      type.  This warning is enabled by default in C99 and later dialects
>      of C, and also by `-Wall'.
> 
> `-Wno-implicit-function-declaration (C and Objective-C only)'
>      This option controls warnings when a function is used before being
>      declared.  This warning is enabled by default in C99 and later
>      dialects of C, and also by `-Wall'.  The warning is made into an
>      error by `-pedantic-errors'.


Irrelevant, I shall ignore this comment -- it is not listed on the "C
Extensions" page.


>> The concept of a language extension has bulletproof meaning. You cannot
>> get around it, redefine it, pretend that something is when it isn't, or
>> otherwise disagree with this bulletproof meaning.
> 
> The concept of a ``language extension'' is not defined anywhere.
> Instead, there are three kinds of behavior not precisely specified by
> the Standard:


The concept of a language extension is defined by the page that says
"these are the extensions to the language". Please take your mendacious
reading of the C standard and put it back where you got it from.


>   - undefined behavior, the behavior upon use of an erroneous construct
>     for which the Standard imposes no requirements whatsoever.
> 
>   - unspecified behavior, where upon the use of a construct for which
>     the Standard imposes two or more possible behaviors, and leaves the
>     selected behavior unspecified.
> 
>   - implementation-defined behavior, unspecified behavior where each
>     implementation documents how the choice is made, and is required to
>     document that choice.
> 
> If the translator precisely defines either undefined behavior (in this
> case, erroneous syntax) or unspecified behavior, then that definition is
> commonly considered to be an extension of that translator.  Nothing
> gcc.info says will change that.


... because the GNUC language dialect is not synonymous with either
undefined, unspecified, or implementation defined behavior. Quoting
random definitions of things that aren't "C Extensions" don't make them
C Extensions.

I also find it difficult to understand how adding a diagnostic telling
you not to do something would be synonymous with "precisely defines"
doing that thing. There's nothing precise about it?

"Nothing gcc.info says will change that". What? Please tell me how this
can be so. What precisely defines the behavior if not the manual?
Defining something is to create a description of that thing. English
language prose is the standard for creating descriptions. That's the
documentation. What else are you looking at here?

> GNU C documentation does not decide what is an extension and what is
> not.


I am framing this and putting it on my wall.


> In any case, if (gcc)C Extensions does not mention extensions
> currently implemented by GCC, then that is a bug in the documentation,
> is it not?  Documentation is supposed to reflect what the program being
> documented does, not the other way around.  Like the Standard says:
> 
>   An implementation shall be accompanied by a document that defines all
>   implementation- defined and locale-specific characteristics and all
>   extensions.


Please submit a bug report to GCC requesting that this be added to a
section titled "implementation-defined and locale-specific characteristics".

Do not expect it to be added to a section titled "C Extensions to the
language, which shall be known as the acceptable GNUC dialect".


>> You are not writing GNU C code, you never have been. GNU C code is
>> defined by the documentation for GNU C:
>> https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
>>
>> You may take this as me dictating to you that you are not to call this
>> code "GNU C".
> 
> Really?  Then why is __GNUC__ defined, and why does it compile with
> `gcc'?


Why does C++ compile with `gcc` as long as it has the right heuristic
file extension?

Why is __GNUC__ defined when you specifically ask for -std=c89, which is
not -std=gnu89?

I assume because the compiler is kind and forgiving, and will often
allow you to mix dialects even though you shouldn't, if it can be done
safely and without conflicting other stds.


But implicit-function-declarations cannot be done safely.

...


This discussion is going nowhere until you accept that GNUC has a
definition and that definition is separate from "what GCC does when
given UB".


-- 
Eli Schwartz

  parent reply	other threads:[~2023-05-12 11:49 UTC|newest]

Thread overview: 242+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 12:15 More C type errors by default for GCC 14 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                                             ` Eli Schwartz [this message]
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
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)

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=9fc58fad-5d2f-e288-ced5-83fb5813e7af@gmail.com \
    --to=eschwartz93@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=luangruo@yahoo.com \
    /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).