https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92821

--- Comment #8 from Emilio Cobos Álvarez (:emilio) <emilio at crisal dot io> ---
(In reply to Jakub Jelinek from comment #6)
> Note that for most types one ends up with zero or sign extension already due
> to C/C++ promotion rules, though in the ABI still can't use that as
> guarantee, but C++ typed enums aren't promoted.

I see.

Another point that someone made in the Mozilla bug tracker is that the ABI, in
the "Scalar Types" table, specifies that enums are represented as a `signed
fourbyte`.

I'm not sure that applies to typed enums. But just in case, if it does, the ABI
may require sign/zero-extending these too?

Looking at https://bugs.llvm.org/show_bug.cgi?id=12207, which might be a dupe
of the LLVM bug I just filed, doesn't make me very hopeful of LLVM changing
their behavior here.

Would it make sense to make gcc always zero/sign-extend on the caller, even if
not required by the ABI or the language? This makes a bunch of calls from gcc
to llvm-compiled binaries potentially unsafe.

Reply via email to