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

            Bug ID: 121624
           Summary: Invoking method returning floating point type on a nil
                    receiver returns garbage value instead of 0
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libobjc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaloian at doganov dot org
  Target Milestone: ---

According to the Objective-C method invocation semantics, a method returning a
scalar type (of size equal or less than sizeof(void *)) invoked on a nil
receiver should return 0.  Unfortunately, the current implementation in
nil_method.c does this only for integer types. This problem manifests as
application bugs since correctly-written applications already assume that
invoking such method on a nil receiver should return 0.

Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/yavor --with-system-zlib
--disable-multilib --disable-nls --enable-languages=c,c++,lto,objc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250818 (experimental) (GCC)

This bug is also observed in GCC 12 onwards.

Reply via email to