Issue 71636
Summary Aggressive optimization caused by a conditionally uninitialized (but at least unused) argument
Labels new issue
Assignees
Reporter gmc-devel
    The minimal sample on [https://godbolt.org/z/cTPTaWhx3](https://godbolt.org/z/cTPTaWhx3) shows an issue of kind of code elimination by the optimizer, if a call may use a (conditionally) uninitialized argument (pArg). The static analyzer (--analyze) will give further information about the cause:

`warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
        return (*fp)(pArg);
 ^~~~~~~~~~~`

But I've not found any option (like/similar to -Wconditional-uninitialized ) to be informed about this kind of "surprising" side-effect (code elimination) at compile-time. FYI: this kind of optimization seems to be active on -O1 or higher and since LLVM/clang-version 14.

IMHO, I think there should be warnings-option to be informed about (not really dead) code elimination caused as a side-effect of another issue like an uninitialized variable or argument.

Best regards from Salzburg,
Markus
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to