public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95475] New: Imprecise column number of runtime error in unreachable program point
@ 2020-06-02  7:26 haoxintu at gmail dot com
  2020-06-02  7:39 ` [Bug c++/95475] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-02  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95475
           Summary: Imprecise column number of runtime error in
                    unreachable program point
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

$cat test.cc
int main(){
int var = 2;
    switch (var) {
        case 1:                  
        default:                   
            __builtin_unreachable();
    }
}

$cat test.c
int main(){
int var = 2;
    switch (var) {
        case 1:                  
        default:                   
            __builtin_unreachable();

    }
}

$g++ -fsanitize=undefined test.cc ; ./a.out
test.cc:6:34: runtime error: execution reached an unreachable program point

$gcc -fsanitize=undefined test.c ; ./a.out
test.c:6:13: runtime error: execution reached an unreachable program point

In clang-trunk

$clang++ -fsanitize=undefined test.cc ; ./a.out
test.cc:6:13: runtime error: execution reached an unreachable program point
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.cc:6:13 in 

$clang -fsanitize=undefined test.c ; ./a.out
test.c:6:13: runtime error: execution reached an unreachable program point
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test.c:6:13 in 

$g++ --version
g++ (GCC) 11.0.0 20200526 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

* [Bug c++/95475] Imprecise column number of runtime error in unreachable program point
  2020-06-02  7:26 [Bug c++/95475] New: Imprecise column number of runtime error in unreachable program point haoxintu at gmail dot com
@ 2020-06-02  7:39 ` pinskia at gcc dot gnu.org
  2020-06-02  8:04 ` haoxintu at gmail dot com
  2020-06-02  8:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-06-02  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The question is where should it be, at the open of the () or the start of the
identifier __builtin_unreachable ?  In C++, it is the open.  In C, it is the
start.

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

* [Bug c++/95475] Imprecise column number of runtime error in unreachable program point
  2020-06-02  7:26 [Bug c++/95475] New: Imprecise column number of runtime error in unreachable program point haoxintu at gmail dot com
  2020-06-02  7:39 ` [Bug c++/95475] " pinskia at gcc dot gnu.org
@ 2020-06-02  8:04 ` haoxintu at gmail dot com
  2020-06-02  8:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-02  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Haoxin Tu <haoxintu at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> The question is where should it be, at the open of the () or the start of
> the identifier __builtin_unreachable ?  In C++, it is the open.  In C, it is
> the start.

Hi, Andrew,

My question is that GCC treats the identifier "__builtin_unreachable" and
normal identifier differently?

For example

$cat test.cc
int foo_long_identifier(){;}
int main(){
   foo_long_identifier();                       
}

$g++ -w -fsanitize=undefined test.cc ; ./a.out
test.cc:1:5: runtime error: execution reached the end of a value-returning
function without returning a value

I think this time the column number is the start of the identifier
"foo_long_identifier" rather than "()".

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

* [Bug c++/95475] Imprecise column number of runtime error in unreachable program point
  2020-06-02  7:26 [Bug c++/95475] New: Imprecise column number of runtime error in unreachable program point haoxintu at gmail dot com
  2020-06-02  7:39 ` [Bug c++/95475] " pinskia at gcc dot gnu.org
  2020-06-02  8:04 ` haoxintu at gmail dot com
@ 2020-06-02  8:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-02  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Haoxin Tu from comment #2)
> My question is that GCC treats the identifier "__builtin_unreachable" and
> normal identifier differently?

Of course it doesn't.  What matters is what location the FE decides to use as
the location of the CALL_EXPR expression.

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

end of thread, other threads:[~2020-06-02  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  7:26 [Bug c++/95475] New: Imprecise column number of runtime error in unreachable program point haoxintu at gmail dot com
2020-06-02  7:39 ` [Bug c++/95475] " pinskia at gcc dot gnu.org
2020-06-02  8:04 ` haoxintu at gmail dot com
2020-06-02  8:57 ` jakub 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).