public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "geoffk at geoffk dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/14030] missing parameter count check ?
Date: Tue, 11 May 2004 23:19:00 -0000	[thread overview]
Message-ID: <20040511004515.10441.qmail@sourceware.org> (raw)
In-Reply-To: <20040205132550.14030.d.binderman@virgin.net>


------- Additional Comments From geoffk at geoffk dot org  2004-05-11 00:45 -------
Subject: Re:  missing parameter count check ?

"jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From jsm at polyomino dot org dot uk  2004-05-10 22:39 -------
> Subject: Re:  missing parameter count check ?
> 
> On Mon, 10 May 2004, pinskia at gcc dot gnu dot org wrote:
> 
> > Actually this has to do with old style function declarations there was a
> > draft of a pre-DR report about this (or at least something related to
> > this) sent to the gcc@ mailing list but I cannot find it at this point.
> 
> There's no immediate relevance of this feature request to my pre-DR, as in 
> this case it's clear what the standard means and that the code is meant to 
> be accepted as long as g need never be called.
> 
> The code is of course very bad style (simply using unprototyped functions
> at all is somewhat dubious nowadays, but I don't see any real use for
> calls of them with the wrong parameters given that such calls yield
> undefined behavior if ever executed).  As I said in
> <http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01317.html>:
> 
> The manual lists diagnosing this sort of thing under "Certain Changes We
> Don't Want to Make".  IMA means one of the reasons given there no longer
> applies; all calls in a whole program compiled at once could be checked
> for consistency with an old-style definition and compiled into aborts with
> a warning given if inconsistent.  (The most likely reason for it actually
> to be worthwhile to implement this would be to avoid problems arising with
> optimizations attempting to inline such calls, etc..)

Yes, this seems like a good idea: When the compiler is compiling a call
to a function which has no prototype but has a definition, and the
parameters in the definition don't match the actual parameters,
print a warning.

With unit-at-a-time, this will work for all function calls when the
definition is visible in the same translation unit.  With IMA, this is
extended further.

Even if we decide not to do this, the paragraph in the manual should
be changed to delete the words "following the definition".



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14030


      parent reply	other threads:[~2004-05-11  0:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-05 13:25 [Bug c/14030] New: " d dot binderman at virgin dot net
2004-02-05 18:40 ` [Bug c/14030] " bangerth at dealii dot org
2004-05-11 16:35 ` pinskia at gcc dot gnu dot org
2004-05-11 20:32 ` jsm at polyomino dot org dot uk
2004-05-11 23:19 ` geoffk at geoffk dot org [this message]

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=20040511004515.10441.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).