Closed rochus-keller closed 2 months ago
rats just when I thought I had all the LVALUE problems worked out... I will look at it this evening :)
Take it easy, I don't want to spoil your evening.
If you look at it, here is an addition. There are a lot of warnings like the following:
Warning(137) Tester.c(80): '$t1' used without prior assignment
for this code:
OBX$StrCopy(($t1 = (&args),&(struct OBX$Array$1){$t1->$2,1,&((char *)$t1->$a)[0*$t1->$2]}),0,&(const struct OBX$Array$1){8,0,OBX$FromUtf("Permute",8,0)},0);
From my point of view the warning is not necessary, or did I miss something?
From that, it looks like this is an order of evaluation issue? I think the issue here is that you're actually reliant on Unspecified Behavior here, per C23 paper N3096 Annex J: J.1 Unspecified behavior 1 The following are unspecified: .... (16) The order in which the function designator, arguments, and subexpressions within the arguments are evaluated in a function call (6.5.2.2).
This looks like... Not Our Fault:tm: on that warning, try moving the evaluation outside of the function for $t1, also abusing comma operators like this makes the code hard to read.
On Sun, May 5, 2024 at 3:07 PM Rochus Keller @.***> wrote:
Take it easy, I don't want to spoil your evening.
If you look at it, here is an addition. There are a lot of warnings like the following:
Warning(137) Tester.c(80): '$t1' used without prior assignment
for this code:
OBX$StrCopy(($t1 = (&args),&(struct OBX$Array$1){$t1->$2,1,&((char )$t1->$a)[0$t1->$2]}),0,&(const struct OBX$Array$1){8,0,OBX$FromUtf("Permute",8,0)},0);
From my point of view the warning is not necessary, or did I miss something?
— Reply to this email directly, view it on GitHub https://github.com/LADSoft/OrangeC/issues/1028#issuecomment-2094915711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSPBTWFX7KABI2LKTTIKFLZAZ7PZAVCNFSM6AAAAABHH4MFLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHEYTKNZRGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Actually, nevermind, I was getting confused by the code, the extra paren means that you're doing some extremely funky evaluation that makes it extremely hard to parse internally what is going on, so the second block of code you posted (the warning on line 80) the issue is that the comma operator isn't evaluating on a left to right basis, so it can't detect the prior assignment, which would be the cause of issues. Super hard to read that because of just how dense that line is.
On Sun, May 5, 2024 at 3:54 PM chugga fan @.***> wrote:
From that, it looks like this is an order of evaluation issue? I think the issue here is that you're actually reliant on Unspecified Behavior here, per C23 paper N3096 Annex J: J.1 Unspecified behavior 1 The following are unspecified: .... (16) The order in which the function designator, arguments, and subexpressions within the arguments are evaluated in a function call (6.5.2.2).
This looks like... Not Our Fault:tm: on that warning, try moving the evaluation outside of the function for $t1, also abusing comma operators like this makes the code hard to read.
On Sun, May 5, 2024 at 3:07 PM Rochus Keller @.***> wrote:
Take it easy, I don't want to spoil your evening.
If you look at it, here is an addition. There are a lot of warnings like the following:
Warning(137) Tester.c(80): '$t1' used without prior assignment
for this code:
OBX$StrCopy(($t1 = (&args),&(struct OBX$Array$1){$t1->$2,1,&((char )$t1->$a)[0$t1->$2]}),0,&(const struct OBX$Array$1){8,0,OBX$FromUtf("Permute",8,0)},0);
From my point of view the warning is not necessary, or did I miss something?
— Reply to this email directly, view it on GitHub https://github.com/LADSoft/OrangeC/issues/1028#issuecomment-2094915711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSPBTWFX7KABI2LKTTIKFLZAZ7PZAVCNFSM6AAAAABHH4MFLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHEYTKNZRGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
the issue is that the comma operator isn't evaluating on a left to right basis
Isn't the left to right order explicitly specified in the specs?
Yes, you are correct, I am just stating that the warning makes it look like that issue is what is cropping up.
On Sun, May 5, 2024 at 4:33 PM Rochus Keller @.***> wrote:
the issue is that the comma operator isn't evaluating on a left to right basis
Isn't the left to right order explicitly specified in the specs?
— Reply to this email directly, view it on GitHub https://github.com/LADSoft/OrangeC/issues/1028#issuecomment-2094939312, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSPBTQLX6WTB57JGSQOZSDZA2JRBAVCNFSM6AAAAABHH4MFLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHEZTSMZRGI . You are receiving this because you commented.Message ID: @.***>
yeah the code as written seems just fine. I traced the basic problem to expression like this:
struct struct aa { ... }; struct aa nn, mm; *(0, &nn) = mm;
where the LHS is an lvalue but occ thought otherwise lol...
Many thanks!
Meanwhile I merged your changes and tested it again with the above command line and the error indeed disappeared.
But I still get the mentioned warnings which from my point of view are not necessary; but they don't bother me, so for the time being I can continue my exploration.
Thanks again.
This bunch of C99 files was generated with my Oberon compiler: awfy.zip
It compiles with GCC, Clang, MSVC and TCC. With OrangeC (i.e. my orangefront version) I get errors like:
Error(135) Storage.c(57): Lvalue required
where line 57 states:(*($t1 = (&obj),&((struct OBX$Array$1 *)$t1->$a)[i])) = ($t3 = ((struct Storage$Storage *)($t2 = &(*this$)))->class$->buildTreeDepth, $t3($t2, (depth - 1)));
I compiled with this command:
../orangefront -Y -std=c99 -I/home/me/Desktop/OrangeC/src/clibs/stdinc -D__GNUC__ *.c
As far as I understand the standard, the assignment should work.