public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element
@ 2014-02-10 23:37 chengniansun at gmail dot com
  2014-02-11 10:12 ` [Bug c/60139] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: chengniansun at gmail dot com @ 2014-02-10 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60139
           Summary: Imprecise column number for -pedantic on
                    non-computable initializer element
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

I have two questions regarding the warnings by gcc on array initializers. 
1) the column numbers in the warnings by -pedantic are not precise. 
2) the warning message says the warning is enabled by default, but in fact the
warning is only enabled with -pedantic. When I use the command 
    $gcc-trunk -c -std=c89 non-constant-initializers.c
then no warning is emitted.



$: cat non-constant-initializers.c 
void fn() {
  int a1;
  int *p1 = &a1;
  int** array[5] = 
  {&p1, 
        (void*)0, (void*)0, (void*)0, &p1};

}
$: gcc-trunk -c -std=c89 -pedantic non-constant-initializers.c 
non-constant-initializers.c: In function ‘fn’:
non-constant-initializers.c:5:3: warning: initializer element is not computable
at load time [enabled by default]
   {&p1, 
   ^
non-constant-initializers.c:6:9: warning: initializer element is not computable
at load time [enabled by default]
         (void*)0, (void*)0, (void*)0, &p1};
         ^
$: gcc-trunk -c -std=c89 non-constant-initializers.c 
$: 
$:
>From gcc-bugs-return-443254-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Feb 11 00:13:03 2014
Return-Path: <gcc-bugs-return-443254-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13811 invoked by alias); 11 Feb 2014 00:13:02 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13781 invoked by uid 48); 11 Feb 2014 00:12:56 -0000
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/59468] [4.9 Regression] ICE on invalid C++ code with LTO in gimple_get_virt_method_for_binfo, at gimple-fold.c:3224
Date: Tue, 11 Feb 2014 00:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hubicka at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59468-4-yoNubBytab@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59468-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59468-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg01011.txt.bz2
Content-length: 250

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY468

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The ICE is already fixed by my reorg of gimple_get_virt_method_for_vtable.
I am experimenting with patch that adds a warning.

Honza


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

* [Bug c/60139] Imprecise column number for -pedantic on non-computable initializer element
  2014-02-10 23:37 [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element chengniansun at gmail dot com
@ 2014-02-11 10:12 ` mpolacek at gcc dot gnu.org
  2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-11 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-02-11
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a trivial patch for 1), queued up for 5.0.

Re 2), the bug is that pedwarn had 0 instead of OPT_Wpedantic.  I'll fix it up
in a separate patch.
(Seems like we're going to drop the "[enabled by default]" altogether, see
http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00653.html.)


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

* [Bug c/60139] Imprecise column number for -pedantic on non-computable initializer element
  2014-02-10 23:37 [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element chengniansun at gmail dot com
  2014-02-11 10:12 ` [Bug c/60139] " mpolacek at gcc dot gnu.org
  2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
@ 2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
  2021-07-29 17:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-04-30  6:15 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

* [Bug c/60139] Imprecise column number for -pedantic on non-computable initializer element
  2014-02-10 23:37 [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element chengniansun at gmail dot com
  2014-02-11 10:12 ` [Bug c/60139] " mpolacek at gcc dot gnu.org
@ 2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
  2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
  2021-07-29 17:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-04-30  6:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Apr 30 06:14:39 2014
New Revision: 209926

URL: http://gcc.gnu.org/viewcvs?rev=209926&root=gcc&view=rev
Log:
    PR c/60139
    * c-typeck.c (output_init_element): Pass OPT_Wpedantic to pedwarn
    and pedwarn_init.  Use loc insted of input_location.

    * gcc.dg/pr60139.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr60139.c
Modified:
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/60139] Imprecise column number for -pedantic on non-computable initializer element
  2014-02-10 23:37 [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element chengniansun at gmail dot com
                   ` (2 preceding siblings ...)
  2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
@ 2021-07-29 17:26 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-29 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60139

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |edwin+bugs at etorok dot eu

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 37187 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-07-29 17:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-10 23:37 [Bug c/60139] New: Imprecise column number for -pedantic on non-computable initializer element chengniansun at gmail dot com
2014-02-11 10:12 ` [Bug c/60139] " mpolacek at gcc dot gnu.org
2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
2014-04-30  6:15 ` mpolacek at gcc dot gnu.org
2021-07-29 17:26 ` pinskia at gcc dot gnu.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).