"Value in symtab but has no slot number!!"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

"Value in symtab but has no slot number!!"

Ricardo-33
Hello,

I am receiving this error:

      assert(Slot != -1 && "Value in symtab but has no slot number!!");

While trying to generate a module at run time using LLVM classes. Specifically with an instance of
StoreInst class. After I generate all the instructions, I try to save the Module to bytecode, but
I receive that error in the method 'outputSymbolTable'

Does anyone have any idea of why this can be happening?

Thanks in advance

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: "Value in symtab but has no slot number!!"

Reid Spencer
Hi Ricardo,

Yes, its because you have an invalid module. You should run
Module::verify before attempting to write the bytecode. This will
pinpoint the problem for you. However, I think I know what's going on:
you've left an object (a Value not a Type) in the symbol table that is
not in the Module. Not quite sure how you do that, but I suppose its
possible if you manipulated the symbol table directly (don't do
that!) :)  Maybe you have a labeled basic block that you never inserted
into the function?

Reid.

On Fri, 2005-06-03 at 22:17 -0700, Ricardo wrote:

> Hello,
>
> I am receiving this error:
>
>       assert(Slot != -1 && "Value in symtab but has no slot number!!");
>
> While trying to generate a module at run time using LLVM classes. Specifically with an instance of
> StoreInst class. After I generate all the instructions, I try to save the Module to bytecode, but
> I receive that error in the method 'outputSymbolTable'
>
> Does anyone have any idea of why this can be happening?
>
> Thanks in advance
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "Value in symtab but has no slot number!!"

Reid Spencer
Ricardo,

I was a little misleading in my last email (below). There is no
Module::verify method. I was using shorthand but it looks like a
class/method pair. The verification pass is found in the header file
"llvm/Analysis/Verifier.h" and the function to call is:

bool llvm::verifyModule(const Module &M, VerifierFailureAction action)

See the header file for more details.

Reid.

On Fri, 2005-06-03 at 22:29 -0700, Reid Spencer wrote:

> Hi Ricardo,
>
> Yes, its because you have an invalid module. You should run
> Module::verify before attempting to write the bytecode. This will
> pinpoint the problem for you. However, I think I know what's going on:
> you've left an object (a Value not a Type) in the symbol table that is
> not in the Module. Not quite sure how you do that, but I suppose its
> possible if you manipulated the symbol table directly (don't do
> that!) :)  Maybe you have a labeled basic block that you never inserted
> into the function?
>
> Reid.
>
> On Fri, 2005-06-03 at 22:17 -0700, Ricardo wrote:
> > Hello,
> >
> > I am receiving this error:
> >
> >       assert(Slot != -1 && "Value in symtab but has no slot number!!");
> >
> > While trying to generate a module at run time using LLVM classes. Specifically with an instance of
> > StoreInst class. After I generate all the instructions, I try to save the Module to bytecode, but
> > I receive that error in the method 'outputSymbolTable'
> >
> > Does anyone have any idea of why this can be happening?
> >
> > Thanks in advance
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > [hidden email]         http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "Value in symtab but has no slot number!!"

Ricardo-33
In reply to this post by Reid Spencer
Hi Reid,

Thanks for your help! I could detect the problem and the module now can be saved (it was a
problem with some Alloca instructions). I could not find a "verify" method in the Module class,
but just for the records, I did this:

---------------
  PassManager Passes;
  // Add an appropriate TargetData instance for this module...
  Passes.add(new TargetData("save", ModuleToSave));
  // Make sure the input LLVM is well formed.
  Passes.add(createVerifierPass());
  Passes.run(*ModuleToSave);
---------------

I got stuck in another problem. I suppose it's very simple but I do not really know what is
happening. I have a module like this:

------------------------------------
        %binary_tree__0 = type { int, %binary_tree__0*, %binary_tree__0* }
...

        %New__0 = alloca %binary_tree__0* ; <%binary_tree__0**> [#uses=8]

...
        %Load_New__00 = load %binary_tree__0** %New__0 ; <%binary_tree__0*> [#uses=0]

...
        %gep.1 = getelementptr %binary_tree__0* %Load_New__001, int 0, uint 0 ; ...

------------------------------------

Gives the error:

---------------
const llvm::Type* checkType(const llvm::Type*): Assertion `Ty && "Invalid indices for type!"'
---------------

However if I replace the last line for this:

---------------
        %gep.1 = getelementptr %binary_tree__0* %Load_New__001, int 0, uint 1 ; ...
---------------

Where the second index is 1 or 2, it works well. This means that I can obtain the second and third
fields using getelementptr but not the first one! (which is an integer)

Could you please help me?

Thanks!

--- Reid Spencer <[hidden email]> wrote:

> Hi Ricardo,
>
> Yes, its because you have an invalid module. You should run
> Module::verify before attempting to write the bytecode. This will
> pinpoint the problem for you. However, I think I know what's going on:
> you've left an object (a Value not a Type) in the symbol table that is
> not in the Module. Not quite sure how you do that, but I suppose its
> possible if you manipulated the symbol table directly (don't do
> that!) :)  Maybe you have a labeled basic block that you never inserted
> into the function?
>
> Reid.
>
> On Fri, 2005-06-03 at 22:17 -0700, Ricardo wrote:
> > Hello,
> >
> > I am receiving this error:
> >
> >       assert(Slot != -1 && "Value in symtab but has no slot number!!");
> >
> > While trying to generate a module at run time using LLVM classes. Specifically with an
> instance of
> > StoreInst class. After I generate all the instructions, I try to save the Module to bytecode,
> but
> > I receive that error in the method 'outputSymbolTable'
> >
> > Does anyone have any idea of why this can be happening?
> >
> > Thanks in advance
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > [hidden email]         http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: "Value in symtab but has no slot number!!"

Reid Spencer
Hi Ricardo,

On Fri, 2005-06-03 at 23:19 -0700, Ricardo wrote:

> Hi Reid,
>
> Thanks for your help! I could detect the problem and the module now can be saved (it was a
> problem with some Alloca instructions). I could not find a "verify" method in the Module class,
> but just for the records, I did this:
>
> ---------------
>   PassManager Passes;
>   // Add an appropriate TargetData instance for this module...
>   Passes.add(new TargetData("save", ModuleToSave));
>   // Make sure the input LLVM is well formed.
>   Passes.add(createVerifierPass());
>   Passes.run(*ModuleToSave);
> ---------------
>
Perfect! :)

Or, just:

llvm::verifyModule(ModuleToSave);

:)

> I got stuck in another problem. I suppose it's very simple but I do not really know what is
> happening. I have a module like this:
>
> ------------------------------------
> %binary_tree__0 = type { int, %binary_tree__0*, %binary_tree__0* }
> ...
>
> %New__0 = alloca %binary_tree__0* ; <%binary_tree__0**> [#uses=8]
>
> ...
> %Load_New__00 = load %binary_tree__0** %New__0 ; <%binary_tree__0*> [#uses=0]
>
> ...
> %gep.1 = getelementptr %binary_tree__0* %Load_New__001, int 0, uint 0 ; ...
>
> ------------------------------------
>
> Gives the error:
>
> ---------------
> const llvm::Type* checkType(const llvm::Type*): Assertion `Ty && "Invalid indices for type!"'
> ---------------
>
> However if I replace the last line for this:
>
> ---------------
> %gep.1 = getelementptr %binary_tree__0* %Load_New__001, int 0, uint 1 ; ...
> ---------------
>
> Where the second index is 1 or 2, it works well. This means that I can obtain the second and third
> fields using getelementptr but not the first one! (which is an integer)

> Could you please help me?

Unfortunately, this has me a bit baffled too. I think however, that you
need some corrections to your code, or at least to be a little more
explicit with your example.   I note that you have
%Load_New__00 of type %binary_tree_0** with 0 uses. However, you're
passing %Load_New__001 of type %binary_Tree__0* into getelementptr.
While the type of %Load_New_001 is correct for the indexing (two
arguments), %Load_New_00 would require three. Other than that, I don't
see why the two argument form with values 0,0 would cause an assertion
on this. It certainly looks correct to me.

Then again, getelementptr has always baffled me a bit :)

Reid.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

signature.asc (196 bytes) Download Attachment