public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
@ 2021-01-11 16:55 marxin at gcc dot gnu.org
  2021-01-11 16:58 ` [Bug c++/98624] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-11 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98624
           Summary: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member
                    call on null pointer of type 'struct module_state'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: nathan at gcc dot gnu.org
            Blocks: 63426
  Target Milestone: ---

Seen with UBSAN compiler:

$ ./xg++ -B.
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/modules/align-type-1_a.C -c
-fmodules-ts
/home/marxin/Programming/gcc2/gcc/cp/module.cc:5895:29: runtime error: member
call on null pointer of type 'struct module_state'
    #0 0xf56fc4 in trees_out::core_vals(tree_node*)
/home/marxin/Programming/gcc2/gcc/cp/module.cc:5895
    #1 0xf67347 in trees_out::tree_node_vals(tree_node*)
/home/marxin/Programming/gcc2/gcc/cp/module.cc:7141
    #2 0xf6cd92 in trees_out::decl_value(tree_node*, depset*)
/home/marxin/Programming/gcc2/gcc/cp/module.cc:7753
    #3 0xfb2a97 in depset::hash::find_dependencies()
/home/marxin/Programming/gcc2/gcc/cp/module.cc:13199
    #4 0xfd1f35 in module_state::write(elf_out*, cpp_reader*)
/home/marxin/Programming/gcc2/gcc/cp/module.cc:17568
    #5 0xfe1ab8 in finish_module_processing(cpp_reader*)
/home/marxin/Programming/gcc2/gcc/cp/module.cc:19747
    #6 0xdcc2d1 in c_parse_final_cleanups()
/home/marxin/Programming/gcc2/gcc/cp/decl2.c:5178
    #7 0x15ae87f in c_common_parse_file()
/home/marxin/Programming/gcc2/gcc/c-family/c-opts.c:1233
    #8 0x2ccb435 in compile_file /home/marxin/Programming/gcc2/gcc/toplev.c:457
    #9 0x2cd3e17 in do_compile /home/marxin/Programming/gcc2/gcc/toplev.c:2193
    #10 0x2cd441a in toplev::main(int, char**)
/home/marxin/Programming/gcc2/gcc/toplev.c:2332
    #11 0x59b3bff in main /home/marxin/Programming/gcc2/gcc/main.c:39
    #12 0x7ffff6ce5151 in __libc_start_main (/lib64/libc.so.6+0x28151)
    #13 0xa82bdd in _start
(/home/marxin/Programming/gcc2/objdir/gcc/cc1plus+0xa82bdd)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
@ 2021-01-11 16:58 ` marxin at gcc dot gnu.org
  2021-01-15 19:47 ` nathan at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-11 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-01-11

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
  2021-01-11 16:58 ` [Bug c++/98624] " marxin at gcc dot gnu.org
@ 2021-01-15 19:47 ` nathan at gcc dot gnu.org
  2021-01-19 19:37 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-15 19:47 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
  2021-01-11 16:58 ` [Bug c++/98624] " marxin at gcc dot gnu.org
  2021-01-15 19:47 ` nathan at gcc dot gnu.org
@ 2021-01-19 19:37 ` cvs-commit at gcc dot gnu.org
  2021-01-19 19:38 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-19 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:

https://gcc.gnu.org/g:6e6f3ed47e5cb575819f8253e42313664b89b042

commit r11-6797-g6e6f3ed47e5cb575819f8253e42313664b89b042
Author: Nathan Sidwell <nathan@acm.org>
Date:   Tue Jan 19 11:31:57 2021 -0800

    c++: Fix null this pointer [PR 98624]

    There's no need for this function to have an object, so make it
    static and avoid UB.

            PR c++/98624
            gcc/cp/
            * module.cc (trees_out::write_location): Make static.

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-19 19:37 ` cvs-commit at gcc dot gnu.org
@ 2021-01-19 19:38 ` nathan at gcc dot gnu.org
  2021-01-21 13:07 ` nathan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-19 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
fixed  6e6f3ed47e5 2021-01-19 | c++: Fix null this pointer [PR 98624]

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-01-19 19:38 ` nathan at gcc dot gnu.org
@ 2021-01-21 13:07 ` nathan at gcc dot gnu.org
  2021-01-21 18:41 ` cvs-commit at gcc dot gnu.org
  2021-01-21 18:42 ` nathan at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-21 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
I flubbed testing

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-01-21 13:07 ` nathan at gcc dot gnu.org
@ 2021-01-21 18:41 ` cvs-commit at gcc dot gnu.org
  2021-01-21 18:42 ` nathan at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-21 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:

https://gcc.gnu.org/g:7944753fad501194eb8a828d6b74270e79d14a4d

commit r11-6841-g7944753fad501194eb8a828d6b74270e79d14a4d
Author: Nathan Sidwell <nathan@acm.org>
Date:   Thu Jan 21 10:37:23 2021 -0800

    c++: Fix null this pointer [PR 98624]

    One may not use a null this pointer to invoke a static member
    function.  This fixes the remaining ubsan errors found with an
    ubsan bootstrap.

            PR c++/98624
            gcc/cp/
            * module.cc (depset::hash::find_dependencies): Add
            module arg.
            (trees_out::core_vals): Check state before calling
            write_location.
            (sort_cluster, module_state::write): Adjust
            find_dependencies call.

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

* [Bug c++/98624] UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state'
  2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-01-21 18:41 ` cvs-commit at gcc dot gnu.org
@ 2021-01-21 18:42 ` nathan at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-21 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #5 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
7944753fad5 2021-01-21 | c++: Fix null this pointer [PR 98624]

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

end of thread, other threads:[~2021-01-21 18:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 16:55 [Bug c++/98624] New: UBSAN: gcc/cp/module.cc:5895:29: runtime error: member call on null pointer of type 'struct module_state' marxin at gcc dot gnu.org
2021-01-11 16:58 ` [Bug c++/98624] " marxin at gcc dot gnu.org
2021-01-15 19:47 ` nathan at gcc dot gnu.org
2021-01-19 19:37 ` cvs-commit at gcc dot gnu.org
2021-01-19 19:38 ` nathan at gcc dot gnu.org
2021-01-21 13:07 ` nathan at gcc dot gnu.org
2021-01-21 18:41 ` cvs-commit at gcc dot gnu.org
2021-01-21 18:42 ` nathan 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).