Open Quuxplusone opened 15 years ago
Attached test.c
(290 bytes, text/plain): Testcase
The testcase in question works fine with trunk on x86-32; have you tried a trunk build?
I see this failing with svn head.
my target doesn't support aliases, so I can't test this. However, the code
looks very broken: it is assuming that the conflicting value is a global. Try
changing:
GlobalVariable *G = TheModule->getGlobalVariable(Name, true);
to:
GlobalValue *G = TheModule->getNamedValue(Name);
There is probably a corresponding case for global name conflicts somewhere else.
> The testcase in question works fine with trunk on x86-32; have you tried a
trunk build?
Yes, I have now. It still fails. I suspected the Solaris linker at one point
(even though linking isn't involved here), and recompiled with the gnu linker.
It still fails.
> The testcase in question works fine with trunk on x86-32; have you tried a
trunk build?
Yes, I have now. It still fails. I suspected the Solaris linker at one point
(even though linking isn't involved here), and recompiled with the gnu linker.
It still fails.
> Try changing:
> GlobalVariable *G = TheModule->getGlobalVariable(Name, true);
>to:
> GlobalValue *G = TheModule->getNamedValue(Name);
That fixes it, thanks Chris!
> There is probably a corresponding case for global name conflicts somewhere
else.
Unfortunately, I don't know the code well enough to find this.
Hi Chris,
I assume you're referring to the section of code immediately below in llvm-backend.cpp that builds the GlobalVariable declarations?
if (GV->getName() != Name) {
Function *F = TheModule->getFunction(Name);
assert(F && F->isDeclaration() && "A function turned into a global?");
...
That section also looks highly dubious, but I haven't been able to contrive a test case that actually breaks it so far - I'm not certain it's actually reachable code.
Cheers,
Nathan
Attached gv-alias.c
(1172 bytes, text/x-csrc): Test case for related case (global variable looking for function)
Attached alias.patch
(1461 bytes, text/plain): Patch that WORKS AROUND the problem; may NOT be a complete fix
Attached gcc-alias.patch
(1989 bytes, text/plain): Combined patch for alias issues in gcc/llvm-backend.cpp
If this is still a bug at all, it's a dragonegg bug. llvm-gcc is dead.
It fails in dragonegg too.
alias.patch
(1461 bytes, text/plain)test.c
(290 bytes, text/plain)gv-alias.c
(1172 bytes, text/x-csrc)gcc-alias.patch
(1989 bytes, text/plain)