mibintc marked 5 inline comments as done. mibintc added inline comments.
================ Comment at: clang/lib/Sema/SemaExpr.cpp:13129 if (FunctionDecl *F = dyn_cast<FunctionDecl>(CurContext)) { + // If the expression occurs inside an internal global_var_init_function + // then the FunctionDecl is not availble ---------------- sepavloff wrote: > mibintc wrote: > > sepavloff wrote: > > > The standard says that static initializers execute in default FP mode. > > > The standard says ... > > Are you sure about this one? Can you please provide the standards > > reference so I can study it? > >> The standard says ... > > Are you sure about this one? Can you please provide the standards reference > > so I can study it? > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, F.8.5: > ``` > ... All computation for initialization of objects that have static or thread > storage duration is done (as if) at translation time. > ``` > F.8.2: > ``` > During translation the IEC 60559 default modes are in effect: > — The rounding direction mode is rounding to nearest. > — The rounding precision mode (if supported) is set so that results are not > shortened. > — Trapping or stopping (if supported) is disabled on all floating-point > exceptions. > ``` Thanks for the pointer to the reference. The desired semantics of the pragma may differ from the standard. For example I tried this test case with the fp_contract pragma, and the pragma does modify the semantics of the floating point expressions in the initializer. So this issue is still a problem in this patch. // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s #pragma STDC FP_CONTRACT ON float y(); float d(); class ON { float z = y() * 1 + d(); // CHECK-LABEL: define {{.*}} void @_ZN2ONC2Ev{{.*}} //CHECK: llvm.fmuladd.f32{{.*}} }; ON on; #pragma STDC FP_CONTRACT OFF class OFF { float w = y() * 1 + d(); // CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}} //CHECK: fmul float }; OFF off; Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72841/new/ https://reviews.llvm.org/D72841 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits