* [9fans] Plan9 C conversion to unnamed member drops qualifiers
@ 2025-03-25 13:33 Alejandro Colomar via 9fans
2025-03-25 17:13 ` Paul Lalonde
0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Colomar via 9fans @ 2025-03-25 13:33 UTC (permalink / raw)
To: 9fans
[-- Attachment #1.1: Type: text/plain, Size: 660 bytes --]
Hi!
GCC implements Plan9 C extensions, and has a bug by which it allows
discarding qualifiers without a cast. I'm wondering if this is a bug
only in GCC, or if it's a bug also in Plan9. Anyone using a Plan9
compiler can check this code and let me know if it diagnoses about the
qualifier drop?
alx@devuan:~/tmp$ cat q.c
struct foo {
int a;
};
struct bar {
struct foo;
};
void f(struct foo *);
int
main(void)
{
const struct bar b;
f(&b);
}
alx@devuan:~/tmp$ gcc -Wall -Wextra -fplan9-extensions -S q.c
alx@devuan:~/tmp$
Thanks!
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 228 bytes --]
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T3f24d4bc059ffff6-Maed70d5d0ef6f4e48592e247
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9fans] Plan9 C conversion to unnamed member drops qualifiers
2025-03-25 13:33 [9fans] Plan9 C conversion to unnamed member drops qualifiers Alejandro Colomar via 9fans
@ 2025-03-25 17:13 ` Paul Lalonde
0 siblings, 0 replies; 2+ messages in thread
From: Paul Lalonde @ 2025-03-25 17:13 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]
The plan9 C compilers ignore the qualifier drop (and I just compiled the
example to make sure).
Quoting Ken Thompson from "A New C Compiler"
<https://c9x.me/compile/bib/new-c.pdf>:
3.1. Register, volatile, const The keywords register, volatile, and const,
are recognised syntactically but are semantically ignored. Volatile seems
to have no meaning, so it is hard to tell if ignoring it is a departure
from the standard. Const only confuses library interfaces with the hope of
catching some rare errors.
Paul
On Tue, Mar 25, 2025 at 6:44 AM Alejandro Colomar via 9fans <9fans@9fans.net>
wrote:
> Hi!
>
> GCC implements Plan9 C extensions, and has a bug by which it allows
> discarding qualifiers without a cast. I'm wondering if this is a bug
> only in GCC, or if it's a bug also in Plan9. Anyone using a Plan9
> compiler can check this code and let me know if it diagnoses about the
> qualifier drop?
>
> alx@devuan:~/tmp$ cat q.c
> struct foo {
> int a;
> };
>
> struct bar {
> struct foo;
> };
>
> void f(struct foo *);
>
> int
> main(void)
> {
> const struct bar b;
>
> f(&b);
> }
> alx@devuan:~/tmp$ gcc -Wall -Wextra -fplan9-extensions -S q.c
> alx@devuan:~/tmp$
>
> Thanks!
>
> Have a lovely day!
> Alex
>
> --
> <https://www.alejandro-colomar.es/>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T3f24d4bc059ffff6-M04a4a4c1e12910d7799a62bd
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 3731 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-25 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-25 13:33 [9fans] Plan9 C conversion to unnamed member drops qualifiers Alejandro Colomar via 9fans
2025-03-25 17:13 ` Paul Lalonde
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).