9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] gefs unnamed substructure undefined behavior
Date: Sun, 01 Dec 2024 18:09:49 -0500	[thread overview]
Message-ID: <E2AC7D78233AF847F8BEDF6A0581833E@eigenstate.org> (raw)
In-Reply-To: <Z0zMX2KfO1lQzHJg@tilde.institute>

For plan9port/gcc, you can add the '-fplan9-extensions' flag,
and things will work for this, I believe.

(FWIW, I've ported to linux in order to use tsan and asan,
but didn't find it worthwhile to maintain the port; I can
try to find some of the hacks I put in place if you're
interested)

Quoth ashley <ashley@tilde.institute>:
> that seems cromulent to me.
> 
> I noticed this while trying to port gefs to plan9port/gcc it's just
> annoying is all. in any case the man page should reflect the actual
> behavior, and I agree that hard errors are far preferable to
> unspecified behavior if they're possible to detect statically.

How's this?

diff 051804186780ef7f3b2f4cb548be1dd0685de5fe uncommitted
--- a/sys/man/1/2c
+++ b/sys/man/1/2c
@@ -232,7 +232,7 @@
 A structure or union may contain unnamed substructures and subunions.
 The fields of the substructures or
 subunions can then be used as if they were members of the parent
-structure or union (the resolution of a name conflict is unspecified).
+structure or union.
 When a pointer to the outer structure or union is used in a context
 that is only legal for the unnamed substructure, the compiler promotes
 the type and adjusts the pointer value to point at the substructure.
@@ -241,6 +241,10 @@
 statement,
 the unnamed structure or union can be explicitly referenced
 by <struct variable>.<tagname>.
+If an enclosed structure or union contains a member with the same name as the enclosing structure,
+the enclosing structure takes priority.
+If an enclosing structure or union contains two structures with the same member,
+accessing the ambiguous member without disambiguation is an error.
 .TP
 \-
 A structure value can be formed with an expression such as



  reply	other threads:[~2024-12-01 23:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 20:07 ashley
2024-12-01  6:11 ` ori
2024-12-01  8:54   ` qwx
2024-12-01 16:31     ` ori
2024-12-01 20:51   ` ashley
2024-12-01 23:09     ` ori [this message]
2024-12-01 23:23       ` ashley
2024-12-01 23:27       ` ashley
2024-12-02  0:50         ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E2AC7D78233AF847F8BEDF6A0581833E@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).