public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/95714] New: Poor locations for errors in calls to __atomic built-ins
@ 2020-06-16 22:03 redi at gcc dot gnu.org
  2021-05-30 22:25 ` [Bug c/95714] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-16 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95714
           Summary: Poor locations for errors in calls to __atomic
                    built-ins
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

int main()
{
  char c;
  int i;
  __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
}

The C compiler says:

ab.cc: In function 'main':
ab.cc:5:3: error: size mismatch in argument 2 of '__atomic_load'
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |   ^~~~~~~~~~~~~


and the C++ compiler says:

ab.cc: In function 'int main()':
ab.cc:5:41: error: size mismatch in argument 2 of '__atomic_load'
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |                                         ^


Both are poor. Instead of saying "argument 2" and highlighting the function
name or the end of the argument list, we should highlight the relevant
argument:

ab.cc: In function 'main':
ab.cc:5:3: error: size mismatch in argument 2 of '__atomic_load'
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |                     ^~


Even better would be:

ab.cc: In function 'main':
ab.cc:5:3: error: size mismatch in argument 2 of '__atomic_load'
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |                 ^~  ^~
      |                 |   |
      |                 |   int*
      |                 char*

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

* [Bug c/95714] Poor locations for errors in calls to __atomic built-ins
  2020-06-16 22:03 [Bug c/95714] New: Poor locations for errors in calls to __atomic built-ins redi at gcc dot gnu.org
@ 2021-05-30 22:25 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-30 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-05-30
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C++ front-end does a little better than the C front-end now:
apinski@xeond:~/src/upstream-gcc$ ~/upstream-gcc/bin/gcc t887.c
t887.c: In function ‘main’:
t887.c:5:3: error: size mismatch in argument 2 of ‘__atomic_load’
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |   ^~~~~~~~~~~~~
apinski@xeond:~/src/upstream-gcc$ ~/upstream-gcc/bin/g++ t887.c
t887.c: In function ‘int main()’:
t887.c:5:16: error: size mismatch in argument 2 of ‘__atomic_load’
    5 |   __atomic_load(&c, &i, __ATOMIC_SEQ_CST);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~


Confirmed.

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

end of thread, other threads:[~2021-05-30 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 22:03 [Bug c/95714] New: Poor locations for errors in calls to __atomic built-ins redi at gcc dot gnu.org
2021-05-30 22:25 ` [Bug c/95714] " 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).