On Mon, Sep 21, 2026 at 5:53 PM Jakub Jelinek <[email protected]> wrote: > > On Mon, Sep 21, 2026 at 05:46:54PM -0400, Matt Turner wrote: > > Clang rejects the casts on asm output operands in longlong.h > > (-Winvalid-gnu-asm-cast is an error by default), so several of its > > blocks do not build with clang. v1 dropped the casts. Richard pointed > > out that they do check something, because GCC accepts a cast on an asm > > output only when it is a no-op, so an output of the wrong size fails to > > build. This version keeps that check. > > Maybe better fix clang to implement correctly a GNU extension?
I don't think that's a reasonable possibility for a couple of reasons: 1. the output casts don't do anything (except verifying that the conversions are a no-op) 2. they accept it under `-fheinous-gnu-extensions`. Not indicative of a willingness to add it... In grep'ing for something I notice that there are comments in gcc/c/c-typeck.cc:13185 and at gcc/cp/semantics.cc:2318 that say /* ??? Really, this should not be here. Users should be using a proper lvalue, dammit. But there's a long history of using casts in the output operands. In cases like longlong.h, this becomes a primitive form of typechecking -- if the cast can be removed, then the output operand had a type of the proper width; otherwise we'll get an error. Gross, but ... */ If this series is accepted (or needs to be resent) I'll send a patch to update those comments.
