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

            Bug ID: 94076
           Summary: libsanitizer fails with 64-bit time_t
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

I tried bootstrapping a debian armhf system with an experimental glibc
configured with a 64-bit time_t/off_t/ino_t, and saw several failed assertions
on 'struct dirent' and 'struct timeb':

  339 |     typedef char IMPL_PASTE(assertion_failed_##_,
line)[2*(int)(pred)-1]
      |                                                                       
^
../../../../src/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:333:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
  333 | #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
      |                              ^~~~~~~~~~~~~~~~~~~~
../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1495:3:
note: in expansion of macro 'COMPILER_CHECK'
 1495 |   COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
      |   ^~~~~~~~~~~~~~
../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:1213:1:
note: in expansion of macro 'CHECK_TYPE_SIZE'
 1213 | CHECK_TYPE_SIZE(timeb);
      | ^~~~~~~~~~~~~~~
../../../../src/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:339:70:
warning: size of array 'assertion_failed__1213' is not an integral
constant-expression [-Wpedantic]

In particular:
CHECK_SIZE_AND_OFFSET(dirent, d_ino);
CHECK_SIZE_AND_OFFSET(dirent, d_off);
CHECK_SIZE_AND_OFFSET(dirent, d_reclen);
CHECK_TYPE_SIZE(timeb);
CHECK_SIZE_AND_OFFSET(timeb, time);
CHECK_SIZE_AND_OFFSET(timeb, millitm);
CHECK_SIZE_AND_OFFSET(timeb, timezone);
CHECK_SIZE_AND_OFFSET(timeb, dstflag);

The same thing will likely hit on architectures that always set them to 64-bit,
as riscv32 and arc, on musl-1.2+, and on upstream glibc once that the time64
interfaces get enabled there.

Reply via email to