Jump to content

Linker Symbol Table Mangement Is Broken

Recommended Posts

Bug description:

There is a problem related to symbol table management (or possibly dead code removal) in the linker.


Steps to reproduce:

Using the following sample code ...

#include <system.h>

//these ones are okay:
//#define BAD_LABEL  lab
//#define BAD_LABEL  label_4
//#define BAD_LABEL  c
//#define BAD_LABEL  xyz
//#define BAD_LABEL  qwerty
//#define BAD_LABEL  aa

//these ones cause error "internal error: can't resolve label in inline code" on line 39
//#define BAD_LABEL  chpl
//#define BAD_LABEL  ch
//#define BAD_LABEL  chplex

inline void test(void)
goto label_1;
goto label_3;
	goto label_3;
	goto BAD_LABEL;
porta = 1;
trisa = ~0;
porta = 0;
goto label_2;
void main(void)

... uncomment any one of lines 4 - 9 and the sample code will compile and link without error.

... uncomment any one of lines 12 - 14 and the following error will be generated:

bug8.c(39:6): internal error: can't resolve label in inline code


NOTE: I used the BAD_LABEL macro to make it easier to keep changing the name. Use of a macro does not affect occurrence of the problem.


Expected behaviour:

Compile results should be consistent (either they should all work, or they should all fail the same way).

This may or may not be related to dead code removal. Technically, the 2 "goto" lines within the asm block are unreachable. In either case there is a well-defined execution path through all the labels; even if the asm block is removed the labels should still be defined. Even if they are not needed, they should not cause the linker error.


It appears that a strcmp or related lookup function is messed up within the linker, or some internal symbol table entries are being confused with user-defined labels, since the problem appears to be very label-specific in the example code.


Is the problem 100% reproduceable:






Compiler version:



Target device:




Windows XP




Edited by djulien
Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...