This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/67941] [5/6 Regression] calls on function pointer from a captureless lambda cause ubsan warning


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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The UBSAN_NULL instrumentation is added in c-family/c-ubsan.c
(ubsan_maybe_instrument_member_call), on stmt that is
main()::<lambda()>::operator() (0B)
i.e.:
 <call_expr 0x7ffff171e380
    type <void_type 0x7ffff1739150 void VOID
        align 8 symtab 0 alias set -1 canonical type 0x7ffff1739150
        pointer_to_this <pointer_type 0x7ffff17392a0>>
    side-effects nothrow protected
    fn <addr_expr 0x7ffff188b320
        type <pointer_type 0x7ffff187c888 type <method_type 0x7ffff187c7e0>
            unsigned DI
            size <integer_cst 0x7ffff1713e58 constant 64>
            unit size <integer_cst 0x7ffff1713e70 constant 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff187c888>
        constant
        arg 0 <function_decl 0x7ffff187b380 operator() type <method_type
0x7ffff187c7e0>
            addressable used nothrow static tree_2 autoinline decl_3 decl_5 QI
file pr67941.C line 1 col 18 align 16 context <record_type 0x7ffff187c1f8
__lambda0> initial <block 0x7ffff1881600> result <result_decl 0x7ffff171f2d0
D.2176>
            full-name "main()::<lambda()>"
            pending-inline-info 0x7ffff7ff9d80 arguments <parm_decl
0x7ffff188e000 __closure>
            struct-function 0x7ffff187c738>>
    arg 0 <integer_cst 0x7ffff188c228 type <pointer_type 0x7ffff187c690>
constant 0>
    pr67941.C:1:20 start: pr67941.C:1:20 finish: pr67941.C:1:20>
And as the call is to a method (which has METHOD_TYPE), UBSAN_NULL is inserted.
If this is valid, can you suggest which method calls the C++ FE considers (just
with literal NULL passed to this, or others too?) valid?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]