CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
112 lines
4.4 KiB
C
112 lines
4.4 KiB
C
// RUN: %clang_cc1 -triple x86_64-apple-darwin -verify -fsyntax-only %s -Wdouble-promotion
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin -verify -fsyntax-only -x c++ %s -Wdouble-promotion
|
|
|
|
float ReturnFloatFromDouble(double d) {
|
|
return d;
|
|
}
|
|
|
|
float ReturnFloatFromLongDouble(long double ld) {
|
|
return ld;
|
|
}
|
|
|
|
double ReturnDoubleFromLongDouble(long double ld) {
|
|
return ld;
|
|
}
|
|
|
|
double ReturnDoubleFromFloat(float f) {
|
|
return f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
}
|
|
|
|
long double ReturnLongDoubleFromFloat(float f) {
|
|
return f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
}
|
|
|
|
long double ReturnLongDoubleFromDouble(double d) {
|
|
return d; //expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
}
|
|
|
|
double ReturnDoubleFromFloatWithExplicitCast(float f) {
|
|
return (double)f;
|
|
}
|
|
|
|
long double ReturnLongDoubleFromFloatWithExplicitCast(float f) {
|
|
return (long double)f;
|
|
}
|
|
|
|
long double ReturnLongDoubleFromDoubleWithExplicitCast(double d) {
|
|
return (long double)d;
|
|
}
|
|
|
|
void Assignment(float f, double d, long double ld) {
|
|
d = f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
ld = f; //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
ld = d; //expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
d = (double)f;
|
|
ld = (long double)f;
|
|
ld = (long double)d;
|
|
f = d;
|
|
f = ld;
|
|
d = ld;
|
|
}
|
|
|
|
void AssignmentWithExtraParens(float f, double d, long double ld) {
|
|
d = (f); //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
ld = (f); //expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
ld = (d); //expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
d = (double)(f);
|
|
ld = (long double)(f);
|
|
ld = (long double)(d);
|
|
}
|
|
|
|
extern void DoubleParameter(double);
|
|
extern void LongDoubleParameter(long double);
|
|
|
|
void ArgumentPassing(float f, double d) {
|
|
DoubleParameter(f); // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
LongDoubleParameter(f); // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
LongDoubleParameter(d); // expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
DoubleParameter((double)f);
|
|
LongDoubleParameter((long double)f);
|
|
LongDoubleParameter((long double)d);
|
|
}
|
|
|
|
void BinaryOperator(float f, double d, long double ld) {
|
|
f = f * d; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
f = d * f; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
f = f * ld; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
f = ld * f; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
d = d * ld; // expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
d = ld * d; // expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
f = (double)f * d;
|
|
f = d * (double)f;
|
|
f = (long double)f * ld;
|
|
f = ld * (long double)f;
|
|
d = (long double)d * ld;
|
|
d = ld * (long double)d;
|
|
}
|
|
|
|
void MultiplicationAssignment(float f, double d, long double ld) {
|
|
d *= f; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'double'}}
|
|
ld *= f; // expected-warning{{implicit conversion increases floating-point precision: 'float' to 'long double'}}
|
|
ld *= d; // expected-warning{{implicit conversion increases floating-point precision: 'double' to 'long double'}}
|
|
d *= (double)f;
|
|
ld *= (long double)f;
|
|
ld *= (long double)d;
|
|
|
|
// FIXME: These cases should produce warnings as above.
|
|
f *= d;
|
|
f *= ld;
|
|
d *= ld;
|
|
}
|
|
|
|
// FIXME: As with a binary operator, the operands to the conditional operator are
|
|
// converted to a common type and should produce a warning.
|
|
void ConditionalOperator(float f, double d, long double ld, int i) {
|
|
f = i ? f : d;
|
|
f = i ? d : f;
|
|
f = i ? f : ld;
|
|
f = i ? ld : f;
|
|
d = i ? d : ld;
|
|
d = i ? ld : d;
|
|
}
|