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 <[email protected]> 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
