* [9fans] Strange 'uintptr' behavior @ 2022-01-24 16:50 Pavel Klinkovský 2022-01-24 19:33 ` Alexandr Babic 2022-01-24 22:26 ` Skip Tavakkolian 0 siblings, 2 replies; 9+ messages in thread From: Pavel Klinkovský @ 2022-01-24 16:50 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 859 bytes --] Hi all, I tried some artificial example for Plan9 compiler (5c)... This code is compiled without any problem: uintptr frst[] = {nil, nil, nil, nil, nil}; uintptr scnd[] = {nil, nil, frst, &frst[0]}; But this one fails: uintptr frst[] = {nil, nil, nil, nil, nil}; uintptr scnd[] = {nil, nil, frst, &frst[1]}; ...with message: cpu% 5c -p t.c /usr/pavel/t.c:16[t.c:888] initializer is not a constant: scnd OTOH, replacement of 'uintptr' by 'void*' is compiled without any problem: void* frst[] = {nil, nil, nil, nil, nil}; void* scnd[] = {nil, nil, frst, &frst[1]}; Any explanation is appreciated. Pavel ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M240dd4253f2ea03efc2d9013 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 1606 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] Strange 'uintptr' behavior 2022-01-24 16:50 [9fans] Strange 'uintptr' behavior Pavel Klinkovský @ 2022-01-24 19:33 ` Alexandr Babic 2022-01-24 19:49 ` Pavel Klinkovský 2022-01-24 22:26 ` Skip Tavakkolian 1 sibling, 1 reply; 9+ messages in thread From: Alexandr Babic @ 2022-01-24 19:33 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 439 bytes --] hello. what headers you've included? with uintptr i get compilation error: incompatible types: "ULONG" and "IND VOID" for op AS. with void* it compiles without errors. alex.b. ps: are you czech? ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M782b57a9678ac27bcd643f48 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 1025 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] Strange 'uintptr' behavior 2022-01-24 19:33 ` Alexandr Babic @ 2022-01-24 19:49 ` Pavel Klinkovský 2022-01-24 19:54 ` Alexandr Babic 0 siblings, 1 reply; 9+ messages in thread From: Pavel Klinkovský @ 2022-01-24 19:49 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 517 bytes --] > what headers you've included? > As usually: #include <u.h> #include <libc.h> with uintptr i get compilation error: incompatible types: "ULONG" and "IND > VOID" for op AS. > with void* it compiles without errors. > > alex.b. > > ps: are you czech? > Yes. Pavel ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-Mfd55c3e288c7cbeeafb039f5 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 1742 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] Strange 'uintptr' behavior 2022-01-24 19:49 ` Pavel Klinkovský @ 2022-01-24 19:54 ` Alexandr Babic 0 siblings, 0 replies; 9+ messages in thread From: Alexandr Babic @ 2022-01-24 19:54 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 873 bytes --] hi. i inluded them too, but had that error with uintptr. i tried it with 6c, 5c and had same result. (9front installation of plan9) a.b. 24. ledna 2022 20:49:30 SEČ, "Pavel Klinkovský" <pavel.klinkovsky@gmail.com> napsal: >> what headers you've included? >> > >As usually: > >#include <u.h> >#include <libc.h> > > >with uintptr i get compilation error: incompatible types: "ULONG" and "IND >> VOID" for op AS. >> with void* it compiles without errors. >> >> alex.b. >> >> ps: are you czech? >> > > Yes. > > Pavel -- Odesláno aplikací K-9 Mail ze systému Android. Omluvte prosím moji stručnost. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M5c331b90faf1d97a6d872bb8 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 2462 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] Strange 'uintptr' behavior 2022-01-24 16:50 [9fans] Strange 'uintptr' behavior Pavel Klinkovský 2022-01-24 19:33 ` Alexandr Babic @ 2022-01-24 22:26 ` Skip Tavakkolian 2022-01-25 7:48 ` Pavel Klinkovský 1 sibling, 1 reply; 9+ messages in thread From: Skip Tavakkolian @ 2022-01-24 22:26 UTC (permalink / raw) To: 9fans maybe a previous fix was not applied? there is a slight difference in the error messages between the address of zeroth element vs first element (see line 9 vs 10 errors below). regardless, it's working as expected on vanilla Plan 9: % cat addrgames.c #include <u.h> #include <libc.h> void main(int argc, char **argv) { #ifdef USEUINTPTR uintptr frst[] = {nil, nil, nil, nil, nil}; uintptr scnd[] = {nil, nil, frst, &frst[1]}; uintptr thrd[] = {nil, nil, frst, &frst[0]}; #else void* frst[] = {nil, nil, nil, nil, nil}; void* scnd[] = {nil, nil, frst, &frst[1]}; void* thrd[] = {nil, nil, frst, &frst[0]}; #endif exits(""); } % 8c addrgames.c % 5c addrgames.c % vc addrgames.c % 6c addrgames.c % 5c -D USEUINTPTR addrgames.c addrgames.c:8 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:8 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:8 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:8 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:8 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:9 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:9 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:9 incompatible types: "ULONG" and "IND ULONG" for op "AS" addrgames.c:9 incompatible types: "ULONG" and "IND ULONG" for op "AS" addrgames.c:10 incompatible types: "ULONG" and "IND VOID" for op "AS" addrgames.c:10 incompatible types: "ULONG" and "IND VOID" for op "AS" too many errors On Mon, Jan 24, 2022 at 8:51 AM Pavel Klinkovský <pavel.klinkovsky@gmail.com> wrote: > > Hi all, > > I tried some artificial example for Plan9 compiler (5c)... > > This code is compiled without any problem: > uintptr frst[] = {nil, nil, nil, nil, nil}; > uintptr scnd[] = {nil, nil, frst, &frst[0]}; > > But this one fails: > uintptr frst[] = {nil, nil, nil, nil, nil}; > uintptr scnd[] = {nil, nil, frst, &frst[1]}; > > ...with message: > cpu% 5c -p t.c > /usr/pavel/t.c:16[t.c:888] initializer is not a constant: scnd > > OTOH, replacement of 'uintptr' by 'void*' is compiled without any problem: > void* frst[] = {nil, nil, nil, nil, nil}; > void* scnd[] = {nil, nil, frst, &frst[1]}; > > Any explanation is appreciated. > > Pavel > > 9fans / 9fans / see discussions + participants + delivery options Permalink ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M7fd1679cf965fc15eaceaa47 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9fans] Strange 'uintptr' behavior 2022-01-24 22:26 ` Skip Tavakkolian @ 2022-01-25 7:48 ` Pavel Klinkovský 2022-01-25 8:02 ` Re[2]: " Alexandr Babic 0 siblings, 1 reply; 9+ messages in thread From: Pavel Klinkovský @ 2022-01-25 7:48 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 800 bytes --] Sorry, I was not precise enough. I prepared arrays in the initiated data segment: This program cannot be compiled: #include <u.h> #include <libc.h> uintptr frst[] = {nil, nil, nil, nil, nil}; uintptr scnd[] = {nil, nil, frst, &frst[1]}; void main(void) { exits(nil); } ...because of: cpu% 5c t.c t.c:5 initializer is not a constant: scnd This program can be compiled: #include <u.h> #include <libc.h> void* frst[] = {nil, nil, nil, nil, nil}; void* scnd[] = {nil, nil, frst, &frst[1]}; void main(void) { exits(nil); } Pavel ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M55c6dc11d2315bac025e3124 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 1629 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re[2]: [9fans] Strange 'uintptr' behavior 2022-01-25 7:48 ` Pavel Klinkovský @ 2022-01-25 8:02 ` Alexandr Babic 2022-01-25 8:26 ` Alex Musolino 0 siblings, 1 reply; 9+ messages in thread From: Alexandr Babic @ 2022-01-25 8:02 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 869 bytes --] i've tried it again and i can compile both versions 1) and 2) without error at 9front distro of plan9. do you use original 4th release of plan9 or 9front distro? download link of 9front iso: http://9front.org/iso/9front-8593.acc504c319a4b4188479cfa602e40cb6851c0528.amd64.iso.gz 1) #include <u.h> #include <libc.h> uintptr frst[] = {nil, nil, nil, nil, nil}; uintptr scnd[] = {nil, nil, frst, &frst[1]}; void main(void) { exits(nil); } 2) #include <u.h> #include <libc.h> void* frst[] = {nil, nil, nil, nil, nil}; void* scnd[] = {nil, nil, frst, &frst[1]}; void main(void) { exits(nil); } Permalink ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-Mb9de3c2d80c775bfb636982d Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 904 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re[2]: [9fans] Strange 'uintptr' behavior 2022-01-25 8:02 ` Re[2]: " Alexandr Babic @ 2022-01-25 8:26 ` Alex Musolino 2022-01-25 8:33 ` Pavel Klinkovský 0 siblings, 1 reply; 9+ messages in thread From: Alex Musolino @ 2022-01-25 8:26 UTC (permalink / raw) To: 9fans It didn't always work on 9front. Check the dump! After bisecting the dump and looking through the git log, I suspect that 9front changeset 71939a82 [1] will fix it for you. [1] https://git.9front.org/plan9front/plan9front/71939a82ccc505b0baa990d7fe17e7085d0ab8fc/commit.html ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M7ca511b172875758e866dd78 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re[2]: [9fans] Strange 'uintptr' behavior 2022-01-25 8:26 ` Alex Musolino @ 2022-01-25 8:33 ` Pavel Klinkovský 0 siblings, 0 replies; 9+ messages in thread From: Pavel Klinkovský @ 2022-01-25 8:33 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 644 bytes --] Ah, thanks! Going to try... út 25. 1. 2022 v 9:28 odesílatel Alex Musolino <alex@musolino.id.au> napsal: > It didn't always work on 9front. Check the dump! > > After bisecting the dump and looking through the git log, I suspect > that 9front changeset 71939a82 [1] will fix it for you. > > [1] > https://git.9front.org/plan9front/plan9front/71939a82ccc505b0baa990d7fe17e7085d0ab8fc/commit.html > ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-Ma557fc25c99094fa66c5fa53 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription [-- Attachment #2: Type: text/html, Size: 2030 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-01-25 8:34 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-24 16:50 [9fans] Strange 'uintptr' behavior Pavel Klinkovský 2022-01-24 19:33 ` Alexandr Babic 2022-01-24 19:49 ` Pavel Klinkovský 2022-01-24 19:54 ` Alexandr Babic 2022-01-24 22:26 ` Skip Tavakkolian 2022-01-25 7:48 ` Pavel Klinkovský 2022-01-25 8:02 ` Re[2]: " Alexandr Babic 2022-01-25 8:26 ` Alex Musolino 2022-01-25 8:33 ` Pavel Klinkovský
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).