[PATCH] D131555: [Clang] Propagate const context info when emitting compound literal
Simon Tatham via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 10 03:32:32 PDT 2022
simon_tatham added a comment.
The clang code change looks reasonable to me, but I'm not the most expert in that area.
The intended result certainly seems sensible, because the C90-compatible version of that code //without// a constant literal is happy to do doubleāfloat conversion at compile time without complaining about side effects:
static const float separate_array[1] = { 0.1, };
struct { const float *floats; } without_compound_literal = { separate_array };
and so it makes sense that the version with a compound literal should be treated no differently.
Nit in the commit message:
> which should be in effect yet
Surely "which //shouldn't// be in effect yet"?
================
Comment at: clang/test/CodeGen/const-init.c:1
-// RUN: %clang_cc1 -no-opaque-pointers -triple i386-pc-linux-gnu -ffreestanding -Wno-pointer-to-int-cast -Wno-int-conversion -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -no-opaque-pointers -triple i386-pc-linux-gnu -ffreestanding -Wno-pointer-to-int-cast -Wno-int-conversion -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s
----------------
I think some kind of a comment would be useful saying what this option is doing there -- at least, which one of the tests further down the file it's supposed to apply to. Otherwise I could easily imagine someone throwing it out again, and since the test would pass anyway, not noticing that it's no longer testing what it's meant to test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131555/new/
https://reviews.llvm.org/D131555
More information about the cfe-commits
mailing list