public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic
@ 2004-01-10 23:08 bugzilla dot gcc at rtij dot nl
  2004-01-10 23:15 ` [Bug c++/13641] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bugzilla dot gcc at rtij dot nl @ 2004-01-10 23:08 UTC (permalink / raw)
  To: gcc-bugs

Compiling the following program:

int main() { main(); }

Gives no diagnostic until --pedantic is given. The standard doesn't say that no
diagnostic is required, so one is required. In my opinion a diagnostic should be
issued, at least at -Wall.

Actual results:

$ g++ -c main.C
$ g++ -c --pedantic main.C
main.C: In function `int main()':
main.C:1: warning: ISO C++ forbids calling `::main' from within program
main.C:1: warning: ISO C++ forbids taking address of function `::main'

Expected results:
Build without --pedantic should give a diagnostic as well.

Build Date & Platform:
$ g++ --version
g++ (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

Regards,
Martijn Lievaart

-- 
           Summary: calling main: standard requires diagnostic, but
                    diagnostic only with --pedantic
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bugzilla dot gcc at rtij dot nl
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
@ 2004-01-10 23:15 ` pinskia at gcc dot gnu dot org
  2004-01-10 23:31 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-10 23:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-10 23:15 -------
nope, sorry but we are not pedantic by default and there is a reason (read the history about gcc for 
the reason), if you want to have these warnings use -pedantic.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
  2004-01-10 23:15 ` [Bug c++/13641] " pinskia at gcc dot gnu dot org
@ 2004-01-10 23:31 ` gdr at integrable-solutions dot net
  2004-01-11  4:04 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-01-10 23:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-01-10 23:31 -------
Subject: Re:  calling main: standard requires diagnostic, but diagnostic only with --pedantic

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| nope, sorry but we are not pedantic by default and there is a reason

I don't see what is pedantic about this.  We just got it wrong. 
This is an explicit constraint violation.
I don't think it is something that should be controlled by -pedantic.

-- Gaby


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
  2004-01-10 23:15 ` [Bug c++/13641] " pinskia at gcc dot gnu dot org
  2004-01-10 23:31 ` gdr at integrable-solutions dot net
@ 2004-01-11  4:04 ` pinskia at gcc dot gnu dot org
  2004-01-11  4:06 ` [Bug c++/13641] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-11  4:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-11 04:04 -------
Reopening based on what Gaby said because it is not even well defined on some 
targets to call main again (targets without .init sections will not work when calling main 
over again).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
           Keywords|                            |accepts-invalid
         Resolution|INVALID                     |


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] [3.4 Regression] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
                   ` (2 preceding siblings ...)
  2004-01-11  4:04 ` pinskia at gcc dot gnu dot org
@ 2004-01-11  4:06 ` pinskia at gcc dot gnu dot org
  2004-01-12 23:39 ` steven at gcc dot gnu dot org
  2004-01-16 18:09 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-11  4:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-11 04:06 -------
Confirmed, in fact now on the mainline it just warns about taking the address so the part 
about calling is a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-11 04:06:35
               date|                            |
            Summary|calling main: standard      |[3.4 Regression] calling
                   |requires diagnostic, but    |main: standard requires
                   |diagnostic only with --     |diagnostic, but diagnostic
                   |pedantic                    |only with --pedantic
   Target Milestone|---                         |3.4.1


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] [3.4 Regression] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
                   ` (3 preceding siblings ...)
  2004-01-11  4:06 ` [Bug c++/13641] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-01-12 23:39 ` steven at gcc dot gnu dot org
  2004-01-16 18:09 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-01-12 23:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-01-12 23:39 -------
Move back the target for all regressions from 3.4.1 to 3.4.0, as required by 
our bug management policy. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.1                       |3.4.0


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13641] [3.4 Regression] calling main: standard requires diagnostic, but diagnostic only with --pedantic
  2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
                   ` (4 preceding siblings ...)
  2004-01-12 23:39 ` steven at gcc dot gnu dot org
@ 2004-01-16 18:09 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-16 18:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-01-16 18:09 -------
This is not a bug.

There are lots of constraint violations that we do not give errors about unless
-pedantic is specified.  (For example, declaring an array "int a[0]" is accepted
unless -pedantic is specified.)

There is no non-uniformity between addressing and calling; we do not warn about
either case without -pedantic, and we warn about both cases with -pedantic.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-01-16 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-10 23:08 [Bug c++/13641] New: calling main: standard requires diagnostic, but diagnostic only with --pedantic bugzilla dot gcc at rtij dot nl
2004-01-10 23:15 ` [Bug c++/13641] " pinskia at gcc dot gnu dot org
2004-01-10 23:31 ` gdr at integrable-solutions dot net
2004-01-11  4:04 ` pinskia at gcc dot gnu dot org
2004-01-11  4:06 ` [Bug c++/13641] [3.4 Regression] " pinskia at gcc dot gnu dot org
2004-01-12 23:39 ` steven at gcc dot gnu dot org
2004-01-16 18:09 ` mmitchel at gcc dot gnu dot org

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).