Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #105493
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Problems with lcc-win32 |
| Date | 2017-03-06 18:15 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <o9k5ai$1cl$1@dont-email.me> (permalink) |
| References | <3cd2645c-a5a1-4284-8fb4-309e14ee4d8e@googlegroups.com> |
Le 05/03/2017 à 23:12, mertesthomas@gmail.com a écrit :
> The test programs follow:
>
> ========== begin testlcc.c ==========
> /* Compile with:
> * lc -O -g5 -A testlcc.c -o testlcc.exe
> */
>
> #include "stdio.h"
>
> typedef enum {ILLEGALCHAR, EOFCHAR, LETTERCHAR, DIGITCHAR,
> UNDERLINECHAR, SHARPCHAR, QUOTATIONCHAR, APOSTROPHECHAR,
> LEFTPARENCHAR, PARENCHAR, SPECIALCHAR, SPACECHAR,
> NEWLINECHAR} charClass;
>
> typedef int boolType;
>
> charClass ch_class[256 - EOF];
> boolType ch_op[256 - EOF];
>
> #define char_class(CHARACTER) ch_class [((int)(CHARACTER)) - EOF]
> #define op_char(CHARACTER) ch_op [((int)(CHARACTER)) - EOF]
>
> void get_ident (unsigned char *name, unsigned int length)
> {
> printf("length:\n%d # should be: 1\n", length);
> printf("name[0]:\n'%c' (%d) # should be: '$' (36)\n",
> name[0], name[0]);
> printf("op_char(name[0]):\n%d # should be: 1\n",
> op_char(name[0]));
> printf("char_class(name[0]):\n%2d # should be: 10\n",
> char_class(name[0]));
> printf("char_class(name[0])==LEFTPARENCHAR:\n");
> printf("%d # should be: 0\n",
> char_class(name[0])==LEFTPARENCHAR);
> printf("op_char(name[0]) || "
> "char_class(name[0])==LEFTPARENCHAR:\n");
> printf("%d # should be: 1\n",
> op_char(name[0]) ||
> char_class(name[0])==LEFTPARENCHAR);
> printf("char_class(name[0])==PARENCHAR:\n");
> printf("%d # should be: 0\n",
> char_class(name[0])==PARENCHAR);
> printf("op_char(name[0]) || "
> "char_class(name[0])==LEFTPARENCHAR || "
> "char_class(name[0])==PARENCHAR:\n");
> printf("%d # should be 1\n",
> op_char(name[0]) ||
> char_class(name[0])==LEFTPARENCHAR ||
> char_class(name[0])==PARENCHAR);
> printf("length==1 && (op_char(name[0]) || "
> "char_class(name[0])==LEFTPARENCHAR || "
> "char_class(name[0])==PARENCHAR):\n");
> printf("%d # should be 1\n",
> length==1 && (op_char(name[0]) ||
> char_class(name[0])==LEFTPARENCHAR ||
> char_class(name[0])==PARENCHAR));
> }
>
> int main (int argc, char *argv[])
> {
> char_class('$') = SPECIALCHAR;
> op_char('$') = 1;
> get_ident("$", 1);
> }
> ========== end testlcc.c ==========
This test RUNS PERFECTLY WELL both with lcc-win32 or with lcc-win64.
You are not using the LATEST VERSION!
Please before reporting bugs download the latest version. I have
corrected this bug.
>
>
> ========== begin testlcc_2.c ==========
> /* This program triggers an Compiler error (trap), when compiled with */
> /* lcc-win32 version 3.8. Compilation date: Mar 29 2013 13:11:27. */
> /* Compile command: lcc testlcc_2.c */
>
> #include "stdio.h"
>
> int main (int argc, char *argv[])
> {
> int x = 0;
> /* The compilation fails also, when parentheses are used: (x++, (_Bool) 1) */
> _Bool flag = argc != -1 ? x++, (_Bool) 1:(_Bool) 0;
> return 0;
> }
> ========== end testlcc_2.c ==========
>
This compiles OK with lcc-win64. The 32 bit compiler has a problem.
Please use lcc-win64, the 32 bits version is no longer maintained.
>
> ========== begin testlcc_3.c ==========
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <float.h>
> #include <math.h>
>
> typedef int int32Type;
> typedef unsigned int uint32Type;
> typedef long long int64Type;
> typedef unsigned long long uint64Type;
>
> #define INT64TYPE_MAX ((int64Type) 9223372036854775807)
> #define INT64TYPE_MIN ((int64Type) (-INT64TYPE_MAX - 1))
>
> static void check1 (void)
> {
> uint64Type unsigned_result = 4U;
>
> if (unsigned_result > -(uint64Type) INT64TYPE_MIN) {
> printf(" ***** Error: %llu > %llu is true.\n",
> unsigned_result,
> -(uint64Type) INT64TYPE_MIN);
> }
> }
>
> #define MAX_MEMSIZETYPE 0xFFFFFFFF
> #define MAX_BIG_LEN ((MAX_MEMSIZETYPE - 12 + 4) / 4)
>
> static void check2 (void)
> {
> int64Type exponent = 2;
> uint32Type base_size = 2;
>
> if ((uint64Type) exponent + 1 > MAX_BIG_LEN / base_size) {
> printf(" ***** Error: %llu > %u is true.\n",
> (uint64Type) exponent + 1,
> MAX_BIG_LEN / base_size);
> }
> }
>
> typedef uint32Type memSizeType;
>
> #define FMT_X32 "%x"
> #define FMT_X64 "%llx"
>
> #define BIGDIGIT_SIZE 32
> #define BIGDIGIT_MASK 0xFFFFFFFF
>
> typedef uint32Type bigDigitType;
> typedef uint64Type doubleBigDigitType;
>
> #define FMT_X_DIG FMT_X32
> #define FMT_X_DIG2 FMT_X64
>
> static void check3 (void)
> {
> doubleBigDigitType remainder = 0;
> bigDigitType quotientdigit = 1;
> bigDigitType divisordigit = 0;
> bigDigitType dividenddigit = 0x80000000;
>
> /* check3 */
> printf("Condition of while loop: 0x" FMT_X_DIG2 " > 0x" FMT_X_DIG2
> " evaluates to: %d\n",
> (doubleBigDigitType) divisordigit * quotientdigit,
> (remainder << BIGDIGIT_SIZE | dividenddigit),
> (doubleBigDigitType) divisordigit * quotientdigit >
> (remainder << BIGDIGIT_SIZE | dividenddigit));
> while ((doubleBigDigitType) divisordigit * quotientdigit >
> (remainder << BIGDIGIT_SIZE | dividenddigit)) {
> printf(" ***** Error: In while loop although the condition was 0.\n");
> remainder = 0x80000000;
> } /* while */
> printf("After while loop\n");
> } /* check3 */
>
> static void check4 (void)
> {
> char buffer[128];
> char *res1 = "1.00000e+306";
> char *res2 = "1.00000e+307";
> char *res3 = "1.00000e+308";
>
> sprintf(buffer, "%1.5e", 1e306);
> if (strcmp(buffer, "1.00000e+306") != 0) {
> printf(" ***** Error: printf(\"%%1.5e\", 1e306); "
> "writes %s instead of %s\n", buffer, res1);
> }
> sprintf(buffer, "%1.5e", 1e307);
> if (strcmp(buffer, "1.00000e+307") != 0) {
> printf(" ***** Error: printf(\"%%1.5e\", 1e307); "
> "writes %s instead of %s\n", buffer, res2);
> }
> sprintf(buffer, "%1.5e", 1e308);
> if (strcmp(buffer, "1.00000e+308") != 0) {
> printf(" ***** Error: printf(\"%%1.5e\", 1e308); "
> "writes %s instead of %s\n", buffer, res3);
> }
> }
>
> #define FMT_D "%lld"
>
> static void check5 (void)
> {
> uint64Type set1[16];
> uint64Type set2[16];
> int64Type position = 0;
> uint64Type result;
>
> set1[0] = 0x8;
> set2[15] = 0x1;
> result = set1[position - 0] ^ set2[position - -15];
> if (result != 9) {
> printf(" ***** Error: 0x" FMT_X64 " ^ 0x" FMT_X64
> " evaluates to 0x" FMT_X64 "\n",
> set1[position - 0], set2[position - -15], result);
> }
> }
>
> static void check6 (void)
> {
> union {
> uint64Type i;
> double f;
> } dblTransfer;
>
> dblTransfer.f = strtod("-Infinity", NULL);
> if (dblTransfer.i != 0 && dblTransfer.i != 0xfff0000000000000) {
> printf(" ***** Error: strtod(\"-Infinity\", NULL) returns %1.14e\n",
> dblTransfer.f);
> }
> }
>
> static void check7 (void)
> {
> union {
> uint64Type i;
> double f;
> } dblTransfer;
>
> dblTransfer.i = 0xfff8000000000000;
> if (dblTransfer.f == 1.0) {
> printf(" ***** Error: The comparison NaN == 1.0 evaluates to TRUE.\n");
> }
> }
>
> int main (int argc, char *argv[])
> {
> printf("sizeof(int32Type): %u\n", sizeof(int32Type));
> printf("sizeof(int64Type): %u\n", sizeof(int64Type));
> check1();
> check2();
> check3();
> check4();
> check5();
> check6();
> check7();
> return 0;
> }
> ========== end testlcc_3.c ==========
>
This has a problem with test 1. The line
> if (unsigned_result > -(uint64Type) INT64TYPE_MIN)
emits a signed comparison and not an unsigned one. This is an error
and will be corrected in the next release.
This is the only bug I found in your tests.
Again, thanks for your input.
jacob
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problems with lcc-win32 mertesthomas@gmail.com - 2017-03-05 14:12 -0800
Re: Problems with lcc-win32 luser droog <luser.droog@gmail.com> - 2017-03-05 14:46 -0800
Re: Problems with lcc-win32 gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-05 22:57 +0000
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:49 +0100
Re: Problems with lcc-win32 luser droog <luser.droog@gmail.com> - 2017-03-05 22:10 -0800
Re: Problems with lcc-win32 BartC <bc@freeuk.com> - 2017-03-05 23:32 +0000
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:48 +0100
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:44 +0100
Re: Problems with lcc-win32 BartC <bc@freeuk.com> - 2017-03-06 00:13 +0000
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-05 19:35 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 10:26 +0100
Re: Problems with lcc-win32 James Kuyper <jameskuyper@verizon.net> - 2017-03-06 07:08 -0500
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-06 08:37 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:16 +0100
Re: Problems with lcc-win32 jm.bourguet@gmail.com - 2017-03-06 06:54 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 17:18 +0100
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-06 08:42 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:19 +0100
Re: Problems with lcc-win32 jm.bourguet@gmail.com - 2017-03-06 08:44 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:20 +0100
Re: Problems with lcc-win32 mertesthomas@gmail.com - 2017-03-06 00:24 -0800
Re: Problems with lcc-win32 jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-06 18:15 +0100
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-06 18:50 +0100
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 04:50 -0800
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-07 14:54 +0100
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 06:20 -0800
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-07 15:02 +0000
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 08:00 -0800
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-07 20:30 +0100
Re: Problems with lcc-win32 (trimmed) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-08 01:06 +0000
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-08 12:17 +0100
Assigning a struct to an integer (Was: Problems with lcc-win32 (trimmed)) gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-08 11:40 +0000
Re: Problems with lcc-win32 (trimmed) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-08 11:51 +0000
Re: Problems with lcc-win32 (trimmed) Robert Wessel <robertwessel2@yahoo.com> - 2017-03-07 15:27 -0600
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-08 13:50 +0000
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-08 13:51 +0000
csiph-web