public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56989] New: wrong location in error message
@ 2013-04-17 19:11 tromey at gcc dot gnu.org
  2013-04-17 21:08 ` [Bug c/56989] " manu at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tromey at gcc dot gnu.org @ 2013-04-17 19:11 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56989
           Summary: wrong location in error message
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


Consider this program:

extern void voidf(void);
extern int intf(void);

int check(void)
{
  if (voidf() < 0
      || intf() < 0)
    return -1;
  return 0;
}


I compiled it with a recent git gcc and got:

barimba. gcc --syntax-only qq.c
qq.c: In function ‘check’:
qq.c:7:7: error: void value not ignored as it ought to be
       || intf() < 0)
       ^

I think the error message would be more helpful if it pointed
to the call to voidf.
>From gcc-bugs-return-420489-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 17 19:18:22 2013
Return-Path: <gcc-bugs-return-420489-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2131 invoked by alias); 17 Apr 2013 19:18:22 -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 2070 invoked by uid 48); 17 Apr 2013 19:18:19 -0000
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/56990] New: ICE: SIGFPE with -fsanitize=thread and empty struct
Date: Wed, 17 Apr 2013 19:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zsojka at seznam dot cz
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56990-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01634.txt.bz2
Content-length: 1695


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

             Bug #: 56990
           Summary: ICE: SIGFPE with -fsanitize=thread and empty struct
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
                CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org,
                    jakub@gcc.gnu.org, kcc@gcc.gnu.org


Created attachment 29891
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id)891
reduced testcase

Compiler output:
$ gcc -fsanitize=thread testcase.c
testcase.c: In function 'foo':
testcase.c:3:6: internal compiler error: Floating point exception
 void foo(struct S *p)
      ^
0xa24dbf crash_signal
        /mnt/svn/gcc-trunk/gcc/toplev.c:332
0xa3af12 instrument_expr
        /mnt/svn/gcc-trunk/gcc/tsan.c:134
0xa3c406 instrument_gimple
        /mnt/svn/gcc-trunk/gcc/tsan.c:612
0xa3c406 instrument_memory_accesses
        /mnt/svn/gcc-trunk/gcc/tsan.c:635
0xa3c406 tsan_pass
        /mnt/svn/gcc-trunk/gcc/tsan.c:700
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


Program received signal SIGFPE, Arithmetic exception.
0x0000000000a3af12 in instrument_expr (gsi=..., expr=0x7ffff6d9f000,
is_write=is_write@entry=true) at /mnt/svn/gcc-trunk/gcc/tsan.c:134
134       if (bitpos % (size * BITS_PER_UNIT)

Tested revisions:
r198018 - crash
4.8 r196898 - crash


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

* [Bug c/56989] wrong location in error message
  2013-04-17 19:11 [Bug c/56989] New: wrong location in error message tromey at gcc dot gnu.org
@ 2013-04-17 21:08 ` manu at gcc dot gnu.org
  2014-04-29 21:28 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2013-04-17 21:08 UTC (permalink / raw)
  To: gcc-bugs


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-17
                 CC|                            |manu at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-04-17 21:08:52 UTC ---
Index: c-typeck.c
===================================================================
--- c-typeck.c  (revision 198021)
+++ c-typeck.c  (working copy)
@@ -1981,11 +1981,12 @@ default_conversion (tree exp)
   if (TREE_NO_WARNING (orig_exp))
     TREE_NO_WARNING (exp) = 1;

   if (code == VOID_TYPE)
     {
-      error ("void value not ignored as it ought to be");
+      error_at (EXPR_LOC_OR_HERE (exp),
+                "void value not ignored as it ought to be");
       return error_mark_node;
     }

   exp = require_complete_type (exp);
   if (exp == error_mark_node)



/home/manuel/void.c:6:12: error: void value not ignored as it ought to be
   if (voidf() < 0
            ^

The location could be even better, but that is what the c-parser records.

I like Clang's diagnostic much more:

/home/manuel/void.c:6:15: error: invalid operands to binary expression ('void'
and 'int')
  if (voidf() < 0
      ~~~~~~~ ^ ~

It is similar to what g++ produces:

/home/manuel/void.c:6:17: error: invalid operands of types ‘void’ and ‘int’ to
binary ‘operator<’
   if (voidf() < 0
                 ^

but with better locations.
>From gcc-bugs-return-420498-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 17 21:35:58 2013
Return-Path: <gcc-bugs-return-420498-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2989 invoked by alias); 17 Apr 2013 21:35:58 -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 2942 invoked by uid 48); 17 Apr 2013 21:35:54 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/56909] [4.8 regression] s-atopri.adb:multiple undefined references on mingw32
Date: Wed, 17 Apr 2013 21:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56909-4-HCa507OXKW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56909-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56909-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01643.txt.bz2
Content-length: 271


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

--- Comment #15 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-17 21:35:54 UTC ---
> Why below output has '-march=pentiumpro'?

I think it's the autodetected arch, but maybe I'm confused.  Never mind.


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

* [Bug c/56989] wrong location in error message
  2013-04-17 19:11 [Bug c/56989] New: wrong location in error message tromey at gcc dot gnu.org
  2013-04-17 21:08 ` [Bug c/56989] " manu at gcc dot gnu.org
@ 2014-04-29 21:28 ` mpolacek at gcc dot gnu.org
  2014-05-01  7:08 ` mpolacek at gcc dot gnu.org
  2014-05-01  7:09 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-04-29 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I've sent a patch, but it hasn't shown up on ML yet.


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

* [Bug c/56989] wrong location in error message
  2013-04-17 19:11 [Bug c/56989] New: wrong location in error message tromey at gcc dot gnu.org
  2013-04-17 21:08 ` [Bug c/56989] " manu at gcc dot gnu.org
  2014-04-29 21:28 ` mpolacek at gcc dot gnu.org
@ 2014-05-01  7:08 ` mpolacek at gcc dot gnu.org
  2014-05-01  7:09 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-01  7:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu May  1 07:08:19 2014
New Revision: 209969

URL: http://gcc.gnu.org/viewcvs?rev=209969&root=gcc&view=rev
Log:
    PR c/56989
    * c-typeck.c (default_conversion): Use better location for
    error call.

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

Added:
    trunk/gcc/testsuite/gcc.dg/pr56989.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/56989] wrong location in error message
  2013-04-17 19:11 [Bug c/56989] New: wrong location in error message tromey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-05-01  7:08 ` mpolacek at gcc dot gnu.org
@ 2014-05-01  7:09 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-01  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

end of thread, other threads:[~2014-05-01  7:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17 19:11 [Bug c/56989] New: wrong location in error message tromey at gcc dot gnu.org
2013-04-17 21:08 ` [Bug c/56989] " manu at gcc dot gnu.org
2014-04-29 21:28 ` mpolacek at gcc dot gnu.org
2014-05-01  7:08 ` mpolacek at gcc dot gnu.org
2014-05-01  7:09 ` mpolacek 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).