[PATCH] Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp

Rafael Espíndola rafael.espindola at gmail.com
Tue Jan 7 16:14:42 PST 2014


On 7 January 2014 17:12, Cameron McInally <cameron.mcinally at nyu.edu> wrote:
> Hey Rafael,
>
> I don't know. My project has its own build system and build requirements.
>
> Your solution of using report_fatal_error(…) also avoids the warning
> with a release build. Is that the preferred fix? Seems like it would
> save an initialization, but introduce a runtime check into a release
> compiler.

I think it should be a report_fatal_error anyway. Currently a
non-assert llvm silently accepts a broken file with

target datalayout = "i:64:6x"

for example. While no valid "user" tool produces these files, we do
tend to have reasonable errors when given a broken .ll file.

If gcc still warns with that change, we should probably just suppress
the warning. The main issue is not the performance cost of zeroing, it
is that it prevents tools like asan and valgrind from finding real
use-befere-init bugs.

Cheers,
Rafael




More information about the llvm-commits mailing list