* [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
@ 2017-08-22 6:26 Daniel Santos
2017-08-22 7:41 ` Andreas Schwab
2017-08-22 7:50 ` Uros Bizjak
0 siblings, 2 replies; 11+ messages in thread
From: Daniel Santos @ 2017-08-22 6:26 UTC (permalink / raw)
To: gcc-patches, Uros Bizjak, Jan Hubicka, Jonathan Yong
This is a problem that occured because of this code in
ix86_option_override_internal:
if (!opts_set->x_ix86_abi)
opts->x_ix86_abi = DEFAULT_ABI;
I tested this along with my other patches. OK for trunk?
* config/i386/i386-opts.h (enum calling_abi): Modify so that no legal
values are equivalent to zero.
Thanks,
Daniel
Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
---
gcc/config/i386/i386-opts.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
index 542cd0f3d67..8c2b5380e49 100644
--- a/gcc/config/i386/i386-opts.h
+++ b/gcc/config/i386/i386-opts.h
@@ -44,8 +44,8 @@ last_alg
/* Available call abi. */
enum calling_abi
{
- SYSV_ABI = 0,
- MS_ABI = 1
+ SYSV_ABI = 1,
+ MS_ABI = 2
};
enum fpmath_unit
--
2.13.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 6:26 [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW Daniel Santos
@ 2017-08-22 7:41 ` Andreas Schwab
2017-08-22 8:11 ` Uros Bizjak
2017-08-22 16:27 ` Daniel Santos
2017-08-22 7:50 ` Uros Bizjak
1 sibling, 2 replies; 11+ messages in thread
From: Andreas Schwab @ 2017-08-22 7:41 UTC (permalink / raw)
To: Daniel Santos; +Cc: gcc-patches, Uros Bizjak, Jan Hubicka, Jonathan Yong
On Aug 21 2017, Daniel Santos <daniel.santos@pobox.com> wrote:
> This is a problem that occured because of this code in
> ix86_option_override_internal:
>
> if (!opts_set->x_ix86_abi)
> opts->x_ix86_abi = DEFAULT_ABI;
Why is that a problem? Note opts_set vs opts.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 6:26 [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW Daniel Santos
2017-08-22 7:41 ` Andreas Schwab
@ 2017-08-22 7:50 ` Uros Bizjak
2017-08-22 22:28 ` Daniel Santos
2017-08-23 4:18 ` JonY
1 sibling, 2 replies; 11+ messages in thread
From: Uros Bizjak @ 2017-08-22 7:50 UTC (permalink / raw)
To: Daniel Santos; +Cc: gcc-patches, Jan Hubicka, Jonathan Yong
On Tue, Aug 22, 2017 at 4:10 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
> This is a problem that occured because of this code in
> ix86_option_override_internal:
>
> if (!opts_set->x_ix86_abi)
> opts->x_ix86_abi = DEFAULT_ABI;
>
> I tested this along with my other patches. OK for trunk?
>
> * config/i386/i386-opts.h (enum calling_abi): Modify so that no legal
> values are equivalent to zero.
Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
UNKNOWN_ABI.
Then change the above condition to
if (opts_set->x_ix86_abi == UNKNOWN_ABI)
We can't just init -mabi to DEFAULT_ABI, sinde this is selected at
runtime. Maybe a comment should be added for UNKNOWN_ABI, that it is
overriden in ix86_option_override_internal.
Uros.
> Thanks,
> Daniel
>
> Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
> ---
> gcc/config/i386/i386-opts.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
> index 542cd0f3d67..8c2b5380e49 100644
> --- a/gcc/config/i386/i386-opts.h
> +++ b/gcc/config/i386/i386-opts.h
> @@ -44,8 +44,8 @@ last_alg
> /* Available call abi. */
> enum calling_abi
> {
> - SYSV_ABI = 0,
> - MS_ABI = 1
> + SYSV_ABI = 1,
> + MS_ABI = 2
> };
>
> enum fpmath_unit
> --
> 2.13.3
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 7:41 ` Andreas Schwab
@ 2017-08-22 8:11 ` Uros Bizjak
2017-08-22 16:27 ` Daniel Santos
1 sibling, 0 replies; 11+ messages in thread
From: Uros Bizjak @ 2017-08-22 8:11 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Daniel Santos, gcc-patches, Jan Hubicka, Jonathan Yong
On Tue, Aug 22, 2017 at 8:26 AM, Andreas Schwab <schwab@suse.de> wrote:
> On Aug 21 2017, Daniel Santos <daniel.santos@pobox.com> wrote:
>
>> This is a problem that occured because of this code in
>> ix86_option_override_internal:
>>
>> if (!opts_set->x_ix86_abi)
>> opts->x_ix86_abi = DEFAULT_ABI;
>
> Why is that a problem? Note opts_set vs opts.
Uh, indeed. Need to clean my glasses. The above is a flag that
something is specified at command line.
Uros.
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 7:41 ` Andreas Schwab
2017-08-22 8:11 ` Uros Bizjak
@ 2017-08-22 16:27 ` Daniel Santos
1 sibling, 0 replies; 11+ messages in thread
From: Daniel Santos @ 2017-08-22 16:27 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gcc-patches, Uros Bizjak, Jan Hubicka, Jonathan Yong
On 08/22/2017 01:26 AM, Andreas Schwab wrote:
> On Aug 21 2017, Daniel Santos <daniel.santos@pobox.com> wrote:
>
>> This is a problem that occured because of this code in
>> ix86_option_override_internal:
>>
>> if (!opts_set->x_ix86_abi)
>> opts->x_ix86_abi = DEFAULT_ABI;
> Why is that a problem? Note opts_set vs opts.
Just because the test !opts_set->x_ix86_abi will be true rather we
supplied no -mabi parameter or we supplied -mabi=sysv.
Daniel
> Andreas.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 7:50 ` Uros Bizjak
@ 2017-08-22 22:28 ` Daniel Santos
2017-08-22 22:31 ` Uros Bizjak
2017-08-23 4:18 ` JonY
1 sibling, 1 reply; 11+ messages in thread
From: Daniel Santos @ 2017-08-22 22:28 UTC (permalink / raw)
To: gcc-patches, Uros Bizjak, Jan Hubicka, Andreas Schwab
> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
> UNKNOWN_ABI.
It would seem to me that UNSPECIFIED_ABI would be a better value name.
Also, I don't really understand what opts_set and opts are, except that I had
guessed opts_set is what the user asked for (or didn't ask for) and opts is
what we're going to actually use. Am I close?
I'm re-running tests, so if they pass is this OK?
Thanks,
Daniel
---
gcc/config/i386/i386-opts.h | 5 +++--
gcc/config/i386/i386.c | 3 +--
gcc/config/i386/i386.opt | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
index 542cd0f3d67..a1d1552a3c6 100644
--- a/gcc/config/i386/i386-opts.h
+++ b/gcc/config/i386/i386-opts.h
@@ -44,8 +44,9 @@ last_alg
/* Available call abi. */
enum calling_abi
{
- SYSV_ABI = 0,
- MS_ABI = 1
+ UNSPECIFIED_ABI = 0,
+ SYSV_ABI = 1,
+ MS_ABI = 2
};
enum fpmath_unit
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 650bcbc65ae..c08ad55fcd9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5681,12 +5681,11 @@ ix86_option_override_internal (bool main_args_p,
opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags)
? PMODE_DI : PMODE_SI;
- if (!opts_set->x_ix86_abi)
+ if (opts_set->x_ix86_abi == UNSPECIFIED_ABI)
opts->x_ix86_abi = DEFAULT_ABI;
if (opts->x_ix86_abi == MS_ABI && TARGET_X32_P (opts->x_ix86_isa_flags))
error ("-mabi=ms not supported with X32 ABI");
- gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
/* For targets using ms ABI enable ms-extensions, if not
explicit turned off. For non-ms ABI we turn off this
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index cd564315f04..f7b9f9707f7 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -525,7 +525,7 @@ Target Report Mask(IAMCU)
Generate code that conforms to Intel MCU psABI.
mabi=
-Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(SYSV_ABI)
+Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(UNSPECIFIED_ABI)
Generate code that conforms to the given ABI.
Enum
--
2.13.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 22:28 ` Daniel Santos
@ 2017-08-22 22:31 ` Uros Bizjak
2017-08-23 8:04 ` Daniel Santos
0 siblings, 1 reply; 11+ messages in thread
From: Uros Bizjak @ 2017-08-22 22:31 UTC (permalink / raw)
To: Daniel Santos; +Cc: gcc-patches, Jan Hubicka, Andreas Schwab
On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.santos@pobox.com> wrote:
>> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
>> UNKNOWN_ABI.
>
> It would seem to me that UNSPECIFIED_ABI would be a better value name.
>
> Also, I don't really understand what opts_set and opts are, except that I had
> guessed opts_set is what the user asked for (or didn't ask for) and opts is
> what we're going to actually use. Am I close?
Yes. opts_set is a flag that user specified an option at the command line.
However, I fail to see what is the problem. If nothing was specified,
then opts->x_ix86_abi is set to DEFAULT_ABI. Probably we don't need
Init(SYSV_ABI) in mabi= declaration at all.
Uros.
> I'm re-running tests, so if they pass is this OK?
>
> Thanks,
> Daniel
> ---
> gcc/config/i386/i386-opts.h | 5 +++--
> gcc/config/i386/i386.c | 3 +--
> gcc/config/i386/i386.opt | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
> index 542cd0f3d67..a1d1552a3c6 100644
> --- a/gcc/config/i386/i386-opts.h
> +++ b/gcc/config/i386/i386-opts.h
> @@ -44,8 +44,9 @@ last_alg
> /* Available call abi. */
> enum calling_abi
> {
> - SYSV_ABI = 0,
> - MS_ABI = 1
> + UNSPECIFIED_ABI = 0,
> + SYSV_ABI = 1,
> + MS_ABI = 2
> };
>
> enum fpmath_unit
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 650bcbc65ae..c08ad55fcd9 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -5681,12 +5681,11 @@ ix86_option_override_internal (bool main_args_p,
> opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags)
> ? PMODE_DI : PMODE_SI;
>
> - if (!opts_set->x_ix86_abi)
> + if (opts_set->x_ix86_abi == UNSPECIFIED_ABI)
> opts->x_ix86_abi = DEFAULT_ABI;
>
> if (opts->x_ix86_abi == MS_ABI && TARGET_X32_P (opts->x_ix86_isa_flags))
> error ("-mabi=ms not supported with X32 ABI");
> - gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
>
> /* For targets using ms ABI enable ms-extensions, if not
> explicit turned off. For non-ms ABI we turn off this
> diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
> index cd564315f04..f7b9f9707f7 100644
> --- a/gcc/config/i386/i386.opt
> +++ b/gcc/config/i386/i386.opt
> @@ -525,7 +525,7 @@ Target Report Mask(IAMCU)
> Generate code that conforms to Intel MCU psABI.
>
> mabi=
> -Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(SYSV_ABI)
> +Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(UNSPECIFIED_ABI)
> Generate code that conforms to the given ABI.
>
> Enum
> --
> 2.13.3
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 7:50 ` Uros Bizjak
2017-08-22 22:28 ` Daniel Santos
@ 2017-08-23 4:18 ` JonY
1 sibling, 0 replies; 11+ messages in thread
From: JonY @ 2017-08-23 4:18 UTC (permalink / raw)
To: Uros Bizjak, Daniel Santos; +Cc: gcc-patches, Jan Hubicka
[-- Attachment #1.1: Type: text/plain, Size: 969 bytes --]
On 08/22/2017 06:32 AM, Uros Bizjak wrote:
> On Tue, Aug 22, 2017 at 4:10 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
>
>> This is a problem that occured because of this code in
>> ix86_option_override_internal:
>>
>> if (!opts_set->x_ix86_abi)
>> opts->x_ix86_abi = DEFAULT_ABI;
>>
>> I tested this along with my other patches. OK for trunk?
>>
>> * config/i386/i386-opts.h (enum calling_abi): Modify so that no legal
>> values are equivalent to zero.
>
> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
> UNKNOWN_ABI.
>
> Then change the above condition to
>
> if (opts_set->x_ix86_abi == UNKNOWN_ABI)
>
> We can't just init -mabi to DEFAULT_ABI, sinde this is selected at
> runtime. Maybe a comment should be added for UNKNOWN_ABI, that it is
> overriden in ix86_option_override_internal.
>
> Uros.
This sounds sensible if there was ever a time some new ABI is added for x86.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 858 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-22 22:31 ` Uros Bizjak
@ 2017-08-23 8:04 ` Daniel Santos
2017-08-23 8:55 ` Uros Bizjak
0 siblings, 1 reply; 11+ messages in thread
From: Daniel Santos @ 2017-08-23 8:04 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, Jan Hubicka, Andreas Schwab
On 08/22/2017 03:00 PM, Uros Bizjak wrote:
> On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.santos@pobox.com> wrote:
>>> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
>>> UNKNOWN_ABI.
>> It would seem to me that UNSPECIFIED_ABI would be a better value name.
>>
>> Also, I don't really understand what opts_set and opts are, except that I had
>> guessed opts_set is what the user asked for (or didn't ask for) and opts is
>> what we're going to actually use. Am I close?
> Yes. opts_set is a flag that user specified an option at the command line.
>
> However, I fail to see what is the problem. If nothing was specified,
> then opts->x_ix86_abi is set to DEFAULT_ABI.
That is not what is happening. If -mabi=sysv is specified, then the
test (!opts_set->x_ix86_abi) is true since the value of SYSV_ABI is
zero. When that is evaluated as true, then the abi is set to
DEFAULT_ABI, which on Windows is MS_ABI, thus ignoring the command line
option.
> Probably we don't need
> Init(SYSV_ABI) in mabi= declaration at all.
I'm guessing that if we don't specify an Init() option then it will
default to zero? We just need a valid way to differentiate when
-mabi=sysv has been passed from when nothing has been passed.
Daniel
>
> Uros.
>
>> I'm re-running tests, so if they pass is this OK?
>>
>> Thanks,
>> Daniel
>> ---
>> gcc/config/i386/i386-opts.h | 5 +++--
>> gcc/config/i386/i386.c | 3 +--
>> gcc/config/i386/i386.opt | 2 +-
>> 3 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
>> index 542cd0f3d67..a1d1552a3c6 100644
>> --- a/gcc/config/i386/i386-opts.h
>> +++ b/gcc/config/i386/i386-opts.h
>> @@ -44,8 +44,9 @@ last_alg
>> /* Available call abi. */
>> enum calling_abi
>> {
>> - SYSV_ABI = 0,
>> - MS_ABI = 1
>> + UNSPECIFIED_ABI = 0,
>> + SYSV_ABI = 1,
>> + MS_ABI = 2
>> };
>>
>> enum fpmath_unit
>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>> index 650bcbc65ae..c08ad55fcd9 100644
>> --- a/gcc/config/i386/i386.c
>> +++ b/gcc/config/i386/i386.c
>> @@ -5681,12 +5681,11 @@ ix86_option_override_internal (bool main_args_p,
>> opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags)
>> ? PMODE_DI : PMODE_SI;
>>
>> - if (!opts_set->x_ix86_abi)
>> + if (opts_set->x_ix86_abi == UNSPECIFIED_ABI)
>> opts->x_ix86_abi = DEFAULT_ABI;
>>
>> if (opts->x_ix86_abi == MS_ABI && TARGET_X32_P (opts->x_ix86_isa_flags))
>> error ("-mabi=ms not supported with X32 ABI");
>> - gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
>>
>> /* For targets using ms ABI enable ms-extensions, if not
>> explicit turned off. For non-ms ABI we turn off this
>> diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
>> index cd564315f04..f7b9f9707f7 100644
>> --- a/gcc/config/i386/i386.opt
>> +++ b/gcc/config/i386/i386.opt
>> @@ -525,7 +525,7 @@ Target Report Mask(IAMCU)
>> Generate code that conforms to Intel MCU psABI.
>>
>> mabi=
>> -Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(SYSV_ABI)
>> +Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(UNSPECIFIED_ABI)
>> Generate code that conforms to the given ABI.
>>
>> Enum
>> --
>> 2.13.3
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-23 8:04 ` Daniel Santos
@ 2017-08-23 8:55 ` Uros Bizjak
2017-08-24 4:26 ` Daniel Santos
0 siblings, 1 reply; 11+ messages in thread
From: Uros Bizjak @ 2017-08-23 8:55 UTC (permalink / raw)
To: Daniel Santos; +Cc: gcc-patches, Jan Hubicka, Andreas Schwab
On Wed, Aug 23, 2017 at 7:23 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
> On 08/22/2017 03:00 PM, Uros Bizjak wrote:
>> On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.santos@pobox.com> wrote:
>>>> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
>>>> UNKNOWN_ABI.
>>> It would seem to me that UNSPECIFIED_ABI would be a better value name.
>>>
>>> Also, I don't really understand what opts_set and opts are, except that I had
>>> guessed opts_set is what the user asked for (or didn't ask for) and opts is
>>> what we're going to actually use. Am I close?
>> Yes. opts_set is a flag that user specified an option at the command line.
>>
>> However, I fail to see what is the problem. If nothing was specified,
>> then opts->x_ix86_abi is set to DEFAULT_ABI.
>
> That is not what is happening. If -mabi=sysv is specified, then the
> test (!opts_set->x_ix86_abi) is true since the value of SYSV_ABI is
> zero. When that is evaluated as true, then the abi is set to
> DEFAULT_ABI, which on Windows is MS_ABI, thus ignoring the command line
> option.
Let's use the following patch:
--cut here--
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3c82ae64f4f2..f8590f663285 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5682,7 +5682,7 @@ ix86_option_override_internal (bool main_args_p,
? PMODE_DI : PMODE_SI;
if (!opts_set->x_ix86_abi)
- opts->x_ix86_abi = DEFAULT_ABI;
+ printf ("Using default ABI\n"), opts->x_ix86_abi = DEFAULT_ABI;
/* For targets using ms ABI enable ms-extensions, if not
explicit turned off. For non-ms ABI we turn off this
--cut here--
$ ./cc1 -O2 -quiet hello.c
Using default ABI
$ ./cc1 -O2 -mabi=sysv -quiet hello.c
$
$ ./cc1 -O2 -mabi=sysv -quiet hello.c
$
Again, opts_set is set to true when the option is specified on the
command line, it has nothing to do with the value of the option.
> I'm guessing that if we don't specify an Init() option then it will
> default to zero? We just need a valid way to differentiate when
> -mabi=sysv has been passed from when nothing has been passed.
Yes, it defaults to zero, but since we live in c++ world nowadays, we
can't initialize enum with integer zero...
Uros.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
2017-08-23 8:55 ` Uros Bizjak
@ 2017-08-24 4:26 ` Daniel Santos
0 siblings, 0 replies; 11+ messages in thread
From: Daniel Santos @ 2017-08-24 4:26 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc-patches, Jan Hubicka, Andreas Schwab
On 08/23/2017 01:12 AM, Uros Bizjak wrote:
> On Wed, Aug 23, 2017 at 7:23 AM, Daniel Santos <daniel.santos@pobox.com> wrote:
>> On 08/22/2017 03:00 PM, Uros Bizjak wrote:
>>> On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.santos@pobox.com> wrote:
>>>>> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to
>>>>> UNKNOWN_ABI.
>>>> It would seem to me that UNSPECIFIED_ABI would be a better value name.
>>>>
>>>> Also, I don't really understand what opts_set and opts are, except that I had
>>>> guessed opts_set is what the user asked for (or didn't ask for) and opts is
>>>> what we're going to actually use. Am I close?
>>> Yes. opts_set is a flag that user specified an option at the command line.
>>>
>>> However, I fail to see what is the problem. If nothing was specified,
>>> then opts->x_ix86_abi is set to DEFAULT_ABI.
>> That is not what is happening. If -mabi=sysv is specified, then the
>> test (!opts_set->x_ix86_abi) is true since the value of SYSV_ABI is
>> zero. When that is evaluated as true, then the abi is set to
>> DEFAULT_ABI, which on Windows is MS_ABI, thus ignoring the command line
>> option.
> Let's use the following patch:
>
> --cut here--
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 3c82ae64f4f2..f8590f663285 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -5682,7 +5682,7 @@ ix86_option_override_internal (bool main_args_p,
> ? PMODE_DI : PMODE_SI;
>
> if (!opts_set->x_ix86_abi)
> - opts->x_ix86_abi = DEFAULT_ABI;
> + printf ("Using default ABI\n"), opts->x_ix86_abi = DEFAULT_ABI;
>
> /* For targets using ms ABI enable ms-extensions, if not
> explicit turned off. For non-ms ABI we turn off this
> --cut here--
>
> $ ./cc1 -O2 -quiet hello.c
> Using default ABI
> $ ./cc1 -O2 -mabi=sysv -quiet hello.c
> $
> $ ./cc1 -O2 -mabi=sysv -quiet hello.c
> $
>
> Again, opts_set is set to true when the option is specified on the
> command line, it has nothing to do with the value of the option.
Interesting, I get the same result and in fact I can't reproduce the bug
anymore. Either I made a mistake somewhere (likely) or something else
fixed the problem (less likely). I'll try again from where the trunk
was when I filed the bug and close it either invalid or fixed depending
upon which it is.
Thanks!
Daniel
>> I'm guessing that if we don't specify an Init() option then it will
>> default to zero? We just need a valid way to differentiate when
>> -mabi=sysv has been passed from when nothing has been passed.
> Yes, it defaults to zero, but since we live in c++ world nowadays, we
> can't initialize enum with integer zero...
>
> Uros.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-08-24 0:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 6:26 [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW Daniel Santos
2017-08-22 7:41 ` Andreas Schwab
2017-08-22 8:11 ` Uros Bizjak
2017-08-22 16:27 ` Daniel Santos
2017-08-22 7:50 ` Uros Bizjak
2017-08-22 22:28 ` Daniel Santos
2017-08-22 22:31 ` Uros Bizjak
2017-08-23 8:04 ` Daniel Santos
2017-08-23 8:55 ` Uros Bizjak
2017-08-24 4:26 ` Daniel Santos
2017-08-23 4:18 ` JonY
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).