-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[Clang][Driver] Override complex number calculation method by -fno-fast-math #132680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9265cb9
b0e198b
8b947e2
7a5ab14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,14 +177,45 @@ | |
| // RUN: %clang -### -target x86_64 -ffast-math -fcomplex-arithmetic=basic -c %s 2>&1 \ | ||
| // RUN: | FileCheck --check-prefix=BASIC %s | ||
|
|
||
| // BASIC: -complex-range=basic | ||
| // FULL: -complex-range=full | ||
| // PRMTD: -complex-range=promoted | ||
| // BASIC-NOT: -complex-range=improved | ||
| // CHECK-NOT: -complex-range=basic | ||
| // IMPRVD: -complex-range=improved | ||
| // IMPRVD-NOT: -complex-range=basic | ||
| // CHECK-NOT: -complex-range=improved | ||
| // RUN: %clang -### -target x86_64 -fcx-limited-range -fno-fast-math \ | ||
s-watanabe314 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN21 %s | ||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -fno-cx-limited-range -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -fcx-fortran-rules -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN22 %s | ||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -fno-cx-fortran-rules -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -ffast-math -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN23 %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN24 %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=improved -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN25 %s | ||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -fcomplex-arithmetic=full -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -ffp-model=aggressive -fno-fast-math \ | ||
|
||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN23 %s | ||
|
|
||
| // RUN: %clang -### -target x86_64 -ffp-model=fast -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL,WARN24 %s | ||
|
||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -ffp-model=precise -fno-fast-math \ | ||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
| // RUN: %clang -### -Werror -target x86_64 -ffp-model=strict -fno-fast-math \ | ||
|
||
| // RUN: -c %s 2>&1 | FileCheck --check-prefixes=FULL %s | ||
|
|
||
|
|
||
| // WARN1: warning: overriding '-fcx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option] | ||
| // WARN2: warning: overriding '-fno-cx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option] | ||
|
|
@@ -196,5 +227,19 @@ | |
| // WARN14: overriding '-complex-range=promoted' option with '-fcx-limited-range' [-Woverriding-option] | ||
| // WARN17: warning: overriding '-fcomplex-arithmetic=full' option with '-fcomplex-arithmetic=basic' [-Woverriding-option] | ||
| // WARN20: warning: overriding '-fcx-fortran-rules' option with '-fcx-limited-range' [-Woverriding-option] | ||
| // WARN21: warning: overriding '-fcx-limited-range' option with '-fcomplex-arithmetic=full' [-Woverriding-option] | ||
| // WARN22: warning: overriding '-fcx-fortran-rules' option with '-fcomplex-arithmetic=full' [-Woverriding-option] | ||
| // WARN23: warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=full' [-Woverriding-option] | ||
| // WARN24: warning: overriding '-fcomplex-arithmetic=promoted' option with '-fcomplex-arithmetic=full' [-Woverriding-option] | ||
| // WARN25: warning: overriding '-fcomplex-arithmetic=improved' option with '-fcomplex-arithmetic=full' [-Woverriding-option] | ||
|
|
||
| // BASIC: -complex-range=basic | ||
| // FULL: -complex-range=full | ||
| // PRMTD: -complex-range=promoted | ||
| // BASIC-NOT: -complex-range=improved | ||
| // CHECK-NOT: -complex-range=basic | ||
| // IMPRVD: -complex-range=improved | ||
| // IMPRVD-NOT: -complex-range=basic | ||
| // CHECK-NOT: -complex-range=improved | ||
|
|
||
| // ERR: error: unsupported argument 'foo' to option '-fcomplex-arithmetic=' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I remember during our Discourse discussion of this that there was already a
GccRangeComplexOptionvariable here. Do we really need another variable? If you just set GccRangeComplexOption to empty for-ffast-mathand-fno-fast-math, would that give us reasonable diagnostics?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback!
I think it's difficult. I believe diagnostics should be emitted when
Rangespecified with options other than-ffast-mathis overridden by-fno-fast-math. To distinguish between these cases, I think we need a variable that determines what options, including Clang-specific options, were specified before-fno-fast-math. Even if we emptyGccRangeComplexOptionwhen-ffast-mathis spcified, it's impossible to distinguish whether the preceding option before-fno-fast-mathwas-ffast-mathor-fcomplex-arithmetic=basic. If it's acceptable to assign "-ffp-model" or "-fcomplex-arithmetic" toGccRangeComplexOption, then a new variable might not be necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string LastComplexRangeOptiondefault initializationThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that
= ""is unnecessary? I initialized it in the same way asGccRangeComplexOption, but should I remove it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= ""is unnecessary. The newly introduced variable can drop= "". You can also drop= ""for the two existing variables as this is minor change.