Jump to content
  • Advertisement
Sign in to follow this  
virious

Bug in compiler

This topic is 2350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I think I've found a bug in a compiler. For the reproduction of this behaviour, use asrun sample, but modify the script in the script.as so the enum E looks similar to this one:

enum E
{
VALUE1 = 20somegarbage,
VALUE2 = 30moregarbage
}


The application will compile and run without any error. But it should throw some "bad suffix on number" error information.
I think that the problem is in as_tokenizer.cpp in method:

bool asCTokenizer::IsConstant(const char *source, size_t sourceLength, size_t &tokenLength, eTokenType &tokenType) const

which identifies "20somegarbage" and "30moregarbage" as ttIntConstant. In this loop:


size_t n;
for( n = 0; n < sourceLength; n++ )
{
if( source[n] < '0' || source[n] > '9' )
break;
}


it only goes to first unallowed char (in this case "s" for the VALUE1) and does nothing about the fact that 20somegarbage is not a proper constant identifier here.

For this test I'm using HEAD revision (currently 1301), but this error is present in earlier versions of the AngelScript library.

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!