|From:||Esteve Sabaté Juncosa|
|Subject:||[bug-gawk] tokentab and qsort|
|Date:||Fri, 23 Mar 2018 13:56:41 +0000|
hi, first of all, thanks a lot for maintaining this wonderful language and sorry for my worst english.
i don't know if it's a bug or it's a using mode that is not contemplated by the project but i explain to you and do what you consider better. i know that i do things that are not related to the standard.
1. i've modified the tokcompare() function in awkgram.y in order to use strcasecmp() instead of strcmp(). this allow me to write programs where uppercase and lowercase tokens are equivalent. this let me prevent problems about using a variables with similar names but that differ in case.
2. added some new tokens to the token tab.
3. i need the tokentab ordered prior to run a program, as if i defined USE_EBCDIC.
4. this force to run qsort() on the tokentab.
5. any program crashes before start running. the reason i suspect that is the const on the tokentab. if the table is ordered, qsort() doesn't need to change any elements but if you put new elements in an unordered or use strcasecmp() in the compare function, then it has to swap some entries and this makes the crash/core.
6. if remove the const attribute for tokentab, everything runs ok.
I have to say that this has been detected on an amazon aws ec2 instance running an Amazon Linux release 2017.09 64 bits with gcc. This doesn't happen on a mac osx.
I don't know if this is of your interest but i only report to give you knowledge of this behavior to prevent future changes or modifications.
|[Prev in Thread]||Current Thread||[Next in Thread]|