Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250304132444.GT1827@brightrain.aerifal.cx>
Date: Tue, 4 Mar 2025 08:24:44 -0500
From: Rich Felker <dalias@...c.org>
To: Thorsten Glaser <tg@...bsd.de>
Cc: musl@...ts.openwall.com
Subject: Re: f128 aliases for long double math symbols

On Mon, Mar 03, 2025 at 11:08:57AM +0000, Thorsten Glaser wrote:
> Rich Felker dixit:
> >On Sat, Mar 01, 2025 at 09:29:20AM +0100, Florian Weimer wrote:
> >> * Rich Felker:
> >>
> >> > In addition, if the functions were standardized, it would violate the
> >> > requirement of non-equality of function pointers for distinct
> >> > functions.
> >>
> >> Is there really such a requirement for functions that have distinct
> >> types?
> 
> I cannot find anything related in my copy of C99 at least.
> 
> >different functions cannot compare equal.
> 
> But they are equal, on the implementation layer. The aliasing

That's not how this works. That's not how any of this works.

An implementor does not go decide "oh, on the implementation layer,
I'm doing something different from the abstract machine, so I just get
to change the language to match how it works on the implementation
layer."

No, in that case the implementation is just incorrect. A C
implementation must always follow the "as-if rule", i.e. behave as if
the real machine and abstract machine match. The legal transformations
it can make are ones indistinguishable from the behavior defined for
the abstract machine.

> is not done in C, so there’s no UB, and I’ve never seen any
> wording to the effect of forbidding, say, aliasing memcpy and
> memmove, or strcmp and strcoll (and memcpy and strxfrm).

6.5.9 paragraph 6 reads:

     "Two pointers compare equal if and only if both are null
     pointers, both are pointers to the same object (including a
     pointer to an object and a subobject at its beginning) or
     function, both are pointers to one past the last element of the
     same array object, or one is a pointer to one past the end of one
     array object and the other is a pointer to the start of a
     different array object that happens to immediately follow the
     first array object in the address space."

Not if they're implemented with code at the same address. If they're
the *same function*.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.