Couperin wrote:
Here is a new problem I get. It seems to be a new bug :-(
No: Two new bugs. :-((
I can't compile this simple program :
Program Bug08;
Type T_ScreenLimits = Set Of ShortCard;
Const XLimits : T_ScreenLimits = [0,1279];
Var X : ShortCard;
Begin X := 1279; If X In XLimits Then WriteLn('OK'); End;
Bug08.pas:4: warning: integer set size limited to 256 elements from low bound Bug08.pas:4: warning: use -fsetlimit:NUMBER to change the limit at compile time
That's this strange "setlimit" feature. I've tried several times to understand what it does, but apparently, I still don't understand it. I thought it was meant for cases like `[x]' where x is of type Integer or so. Constructing a set of Integer would take 512 MB on a 32 bit machine which is not a good idea. Therefore, GPC limits the range of the set in such cases.
However, in this case here, (a) the range is only ShortCard (16 bits, i.e. 2^16 bits = 8 KB for a set which is no problem) and (b) the set variable (or constant) is actually declared, so truncating it is wrong, anyway. So, I'd have thought that "setlimit" doesn't apply here, but for some reason it does.
Even stranger, if you replace ShortCard by 0 .. 65535 (which is exactly the same on most machines), it works. (This, at least, gives a work-around for you.)
Bug08.pas:9: Internal compiler error in `get_set_constructor_bits', at tree.c:5016
This seems to be a consequence of the first bug and the fact that the code that deals with set constants seems to lack any range-checking and wildly overwrites memory when you exceed the (truncated) set range. A severe bug indeed, thanks for the report.
Program Temp;
Var X : ShortCard; Begin X := 1279; If X In [0,1279] Then WriteLn('OK'); End.
Even stranger that "setlimit" applies here, because such checks are usually internally converted to more efficient comparisons (i.e. (X = 0) or (X = 1279)), and a set is never actually constructed. Or that's what I thought...
Last question : To who may I submit test programs If I think it could be added to the Test Suite of GPC sources ?
Here's a good place. I'm putting your test programs in the Test Suite with only two changes: I'm adding an "Else WriteLn('failed')" line at the end (not strictly necessary, though), and renaming them to couper8 etc., to distringuish them from other people's test programs and to fit in 8+3 characters for Dos systems).
Please submit a full bug report. See URL:http://www.gnu.org/software/gcc/faq.html#bugreport for instructions.
...
Is it a GPC bug or a GCC bug ? Do I really have to report it at {HYPERLINK "mailto:gcc-bugs@gcc.gnu.org"}gcc-bugs@gcc.gnu.org ?
I don't think so. Maybe they'll forward such reports concerning GPC to us, but this list is the more direct contact. I think the address in the compiler should be changed to point to our mailing list.
Frank