[PATCH] D155356: [clang][Interp] Implement __builtin_nan family of functions

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 21:10:19 PDT 2023


tbaeder added a comment.

One thing I'm wondering though is:

  constexpr char A[] = {'1', '2', '3'};
  constexpr double d = __builtin_nans(A);

what's expected here? The given char array is not null-terminated. 
Should the interpreter ignore the null byte at the end if it's there? `StringRef::getAsInteger()` always returns an error if it encounters one, so the currentcode in `InterpBuiltin.cpp` ignores the last byte and will pass `12` along for the example above.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155356/new/

https://reviews.llvm.org/D155356



More information about the cfe-commits mailing list