[PATCH] D27547: Allow common linkage global var have non-zero initializer

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 18:35:24 PST 2016


Yaxun Liu via Phabricator via llvm-commits <llvm-commits at lists.llvm.org>
writes:

> yaxunl created this revision.
> yaxunl added a reviewer: tstellarAMD.
> yaxunl added a subscriber: llvm-commits.
> Herald added a subscriber: wdng.
>
> In C99 tentative definition of file-scope variable results in common linkage, e.g.
>
>   private char *p;
>   private char *p;
>
> which are initialized by default initializer. For pointer type global variable, the default initializer is null pointer, which does not necessarily have zero value. If a structure contains  pointer type member for which null pointer does not have zero value, the strucutre cannot be initialized with zeroinitializer.
>
> Currently IR Verifier asserts when a global variable with common linkage has an initializer which is not zeroinitializer, which it should not. This patch fixes that.

How is this represented it the object file level?

Cheers,
Rafael


More information about the llvm-commits mailing list