* ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
@ 2007-07-23 15:49 Kai Tietz
2007-07-23 16:20 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: Kai Tietz @ 2007-07-23 15:49 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
Hello,
I reported last week an ICE for target x86_64-pc-mingw32 target while
building libgfortran. There is a bug in gfc_init_decl_processing in file
f95-lang.c. Within this function sizetype is getting initialized as a
"long_unsigned_type_node" - which is for most targets valid - but the
target x86_64-pc-mingw32 has a size_t of type
"long_long_unsigned_type_node". The following patch solves this problem:
ChangeLog: /gcc/fortran
2007-07-23 Kai Tietz <kai.tietz@onevision.com>
* f95-lang.c: (gfc_init_decl_processing): Use
long_long_unsigned_type_node
for target x86_64 mingw32 as sizetype.
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
[-- Attachment #2: w64fortran.txt --]
[-- Type: text/plain, Size: 683 bytes --]
Index: gcc/gcc/fortran/f95-lang.c
===================================================================
--- gcc.orig/gcc/fortran/f95-lang.c
+++ gcc/gcc/fortran/f95-lang.c
@@ -616,6 +616,11 @@ gfc_init_decl_processing (void)
only use it for actual characters, not for INTEGER(1). Also, we
want double_type_node to actually have double precision. */
build_common_tree_nodes (false, false);
+#ifdef TARGET_64BIT_MS_ABI
+ if (TARGET_64BIT_MS_ABI)
+ set_sizetype (long_long_unsigned_type_node);
+ else
+#endif
set_sizetype (long_unsigned_type_node);
build_common_tree_nodes_2 (0);
void_list_node = build_tree_list (NULL_TREE, void_type_node);
=
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
2007-07-23 15:49 ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target Kai Tietz
@ 2007-07-23 16:20 ` Paolo Bonzini
2007-07-24 7:15 ` Kai Tietz
0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2007-07-23 16:20 UTC (permalink / raw)
To: Kai Tietz; +Cc: gcc-patches
> 2007-07-23 Kai Tietz <kai.tietz@onevision.com>
> * f95-lang.c: (gfc_init_decl_processing): Use
> long_long_unsigned_type_node
> for target x86_64 mingw32 as sizetype.
You should not introduce dependence on the target defines in the
front-ends. I suggest that you try instead
set_sizetype (gfc_type_for_mode (Pmode, 1));
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
2007-07-23 16:20 ` Paolo Bonzini
@ 2007-07-24 7:15 ` Kai Tietz
2007-07-24 7:18 ` Paolo Bonzini
0 siblings, 1 reply; 8+ messages in thread
From: Kai Tietz @ 2007-07-24 7:15 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
Hi Paolo,
>
> > 2007-07-23 Kai Tietz
> > * f95-lang.c: (gfc_init_decl_processing): Use
> > long_long_unsigned_type_node
> > for target x86_64 mingw32 as sizetype.
>
> You should not introduce dependence on the target defines in the
> front-ends. I suggest that you try instead
>
> set_sizetype (gfc_type_for_mode (Pmode, 1));
This would not work, because the type fields used by gfc_type_for_mode are
not initialized at this point. They are initialized by gfc_init_types () 6
lines down. I would suggest to do this by using the TREE_MODE of both
types to make the correct choice.
Cheers,
i.A. Kai Tietz
[-- Attachment #2: w64fortran2.txt --]
[-- Type: text/plain, Size: 1029 bytes --]
Index: gcc/gcc/fortran/f95-lang.c
===================================================================
--- gcc.orig/gcc/fortran/f95-lang.c
+++ gcc/gcc/fortran/f95-lang.c
@@ -616,7 +616,15 @@ gfc_init_decl_processing (void)
only use it for actual characters, not for INTEGER(1). Also, we
want double_type_node to actually have double precision. */
build_common_tree_nodes (false, false);
- set_sizetype (long_unsigned_type_node);
+ /* x86_64 minw32 has a sizetype of "unsigned long long", most other hosts
+ have a sizetype of "unsigned long". Therefore choose the correct size
+ in mostly target independent way. */
+ if (TYPE_MODE (long_unsigned_type_node) == Pmode)
+ set_sizetype (long_unsigned_type_node);
+ else if (TYPE_MODE (long_long_unsigned_type_node) == Pmode)
+ set_sizetype (long_long_unsigned_type_node);
+ else
+ set_sizetype (long_unsigned_type_node);
build_common_tree_nodes_2 (0);
void_list_node = build_tree_list (NULL_TREE, void_type_node);
=
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
2007-07-24 7:15 ` Kai Tietz
@ 2007-07-24 7:18 ` Paolo Bonzini
2007-07-27 13:06 ` Kai Tietz
0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2007-07-24 7:18 UTC (permalink / raw)
To: Kai Tietz; +Cc: gcc-patches
>> You should not introduce dependence on the target defines in the
>> front-ends. I suggest that you try instead
>>
>> set_sizetype (gfc_type_for_mode (Pmode, 1));
>
> This would not work, because the type fields used by gfc_type_for_mode are
> not initialized at this point. They are initialized by gfc_init_types () 6
> lines down. I would suggest to do this by using the TREE_MODE of both
> types to make the correct choice.
While undoubtedly better, this may still be unsatisfactory because some
ports may use 16-bit pointers too (I'm not sure if the Fortran run-time
library runs there).
The Fortran maintainers could accept this patch and I've no intention to
object, but you may also try moving gfc_init_types up, or set_sizetype
down, so that you can use gfc_type_for_mode.
Paolo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
2007-07-24 7:18 ` Paolo Bonzini
@ 2007-07-27 13:06 ` Kai Tietz
2007-07-27 14:18 ` Paul Thomas
0 siblings, 1 reply; 8+ messages in thread
From: Kai Tietz @ 2007-07-27 13:06 UTC (permalink / raw)
To: Paul Richard Thomas; +Cc: gcc-patches, bonzini
Hi Paul,
Paolo Bonzini wrote on 24.07.2007 09:07:36:
> >> You should not introduce dependence on the target defines in the
> >> front-ends. I suggest that you try instead
> >>
> >> set_sizetype (gfc_type_for_mode (Pmode, 1));
> >
> > This would not work, because the type fields used by gfc_type_for_mode
are
> > not initialized at this point. They are initialized by gfc_init_types
() 6
> > lines down. I would suggest to do this by using the TREE_MODE of both
> > types to make the correct choice.
>
> While undoubtedly better, this may still be unsatisfactory because some
> ports may use 16-bit pointers too (I'm not sure if the Fortran run-time
> library runs there).
Hmm, I am uncertain to move the gfc_type_for_mode for getting the proper
sizetype, because AFAICS it would return the nearest type, which means it
returns an 'unsigned int' for 32-bit instead of the 'unsigned long' type
node. Therefore I think my updated patch makes thinks more correct.
Do you know, if 16-bit targets are currently supported by gfortan ?
> The Fortran maintainers could accept this patch and I've no intention to
> object, but you may also try moving gfc_init_types up, or set_sizetype
> down, so that you can use gfc_type_for_mode.
Maybe you are the right person to comment on this ?
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
2007-07-27 13:06 ` Kai Tietz
@ 2007-07-27 14:18 ` Paul Thomas
0 siblings, 0 replies; 8+ messages in thread
From: Paul Thomas @ 2007-07-27 14:18 UTC (permalink / raw)
To: Kai Tietz; +Cc: Paul Richard Thomas, gcc-patches, bonzini
Kai,
It might be better to ask Paul Brook, since he wrote this part of
gfortran. Alternatively, go to the list; I honestly have no useful
advice to offer you.
Cheers
Paul
> Hi Paul,
>
> Paolo Bonzini wrote on 24.07.2007 09:07:36:
>
>>>> You should not introduce dependence on the target defines in the
>>>> front-ends. I suggest that you try instead
>>>>
>>>> set_sizetype (gfc_type_for_mode (Pmode, 1));
>>>>
>>> This would not work, because the type fields used by gfc_type_for_mode
>>>
> are
>
>>> not initialized at this point. They are initialized by gfc_init_types
>>>
> () 6
>
>>> lines down. I would suggest to do this by using the TREE_MODE of both
>>> types to make the correct choice.
>>>
>> While undoubtedly better, this may still be unsatisfactory because some
>> ports may use 16-bit pointers too (I'm not sure if the Fortran run-time
>> library runs there).
>>
> Hmm, I am uncertain to move the gfc_type_for_mode for getting the proper
> sizetype, because AFAICS it would return the nearest type, which means it
> returns an 'unsigned int' for 32-bit instead of the 'unsigned long' type
> node. Therefore I think my updated patch makes thinks more correct.
> Do you know, if 16-bit targets are currently supported by gfortan ?
>
>
>> The Fortran maintainers could accept this patch and I've no intention to
>>
>
>
>> object, but you may also try moving gfc_init_types up, or set_sizetype
>> down, so that you can use gfc_type_for_mode.
>>
> Maybe you are the right person to comment on this ?
>
> Cheers,
> i.A. Kai Tietz
>
> | (\_/) This is Bunny. Copy and paste Bunny
> | (='.'=) into your signature to help him gain
> | (")_(") world domination.
>
> ------------------------------------------------------------------------------------------
> OneVision Software Entwicklungs GmbH & Co. KG
> Dr.-Leo-Ritter-StraÃe 9 - 93049 Regensburg
> Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
> Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
> Handelsregister: HRA 6744, Amtsgericht Regensburg
> Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
> Dr.-Leo-Ritter-StraÃe 9 â 93049 Regensburg
> Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
> Ulrike Döhler, Manuela Kluger
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
[not found] <46ADB161.7030808@gmx.de>
@ 2007-08-03 16:44 ` FX Coudert
0 siblings, 0 replies; 8+ messages in thread
From: FX Coudert @ 2007-08-03 16:44 UTC (permalink / raw)
To: Kai.Tietz; +Cc: GFORTRAN list, GCC-patches list
Hi Kai,
> I got from Paul Thomas the hint that you are the author of the f95-
> lang.c
> file of gcc. So may you are the right person to comment or approve
> this
> patch.I found the problem in gfc_init_decl_processing choosing the
> wrong
> 'sizetype' type for some targets. The code assumes, that the
> 'sizetype' is
> a 'unsigned long', which is not true for the x86_64-pc-mingw32 target.
Don't you have to change gcc/c-common.c (c_common_nodes_and_builtins)
also, then?
> Additionally there was coming up some question about the support of
> the
> fortan compiler for 16-bit targets (but this is an off topic issue
> IMHO).
It depends: do you expect your patch to change the situation in any
way for a 16-bit target? (I'm sorry that I don't know enough of these
targets to actually answer that question myself)
> 2007-07-23 Kai Tietz <kai.tietz@onevision.com>
> * f95-lang.c: (gfc_init_decl_processing): Choose sizetype
> by using
> Pmode.
Although I'm not Paul, this looks OK to me, but it's still safer to
ping Paul if you don't hear from him (holidays?).
FX
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target
@ 2007-07-30 8:42 Kai Tietz
0 siblings, 0 replies; 8+ messages in thread
From: Kai Tietz @ 2007-07-30 8:42 UTC (permalink / raw)
To: Paul Brook; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]
Hi Paul,
I got from Paul Thomas the hint that you are the author of the f95-lang.c
file of gcc. So may you are the right person to comment or approve this
patch.I found the problem in gfc_init_decl_processing choosing the wrong
'sizetype' type for some targets. The code assumes, that the 'sizetype' is
a 'unsigned long', which is not true for the x86_64-pc-mingw32 target.
This target defines the 'long' type 32-bit and a pointer is 64-bit (a
'long long'). This results in an ICE for the fortan compiler for the
x86_64-pc-mingw32 target. The attached patch fixes this problem.
Additionally there was coming up some question about the support of the
fortan compiler for 16-bit targets (but this is an off topic issue IMHO).
2007-07-23 Kai Tietz <kai.tietz@onevision.com>
* f95-lang.c: (gfc_init_decl_processing): Choose sizetype by using
Pmode.
Thanks in advance and cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
[-- Attachment #2: w64fortran2.txt --]
[-- Type: text/plain, Size: 1029 bytes --]
Index: gcc/gcc/fortran/f95-lang.c
===================================================================
--- gcc.orig/gcc/fortran/f95-lang.c
+++ gcc/gcc/fortran/f95-lang.c
@@ -616,7 +616,15 @@ gfc_init_decl_processing (void)
only use it for actual characters, not for INTEGER(1). Also, we
want double_type_node to actually have double precision. */
build_common_tree_nodes (false, false);
- set_sizetype (long_unsigned_type_node);
+ /* x86_64 minw32 has a sizetype of "unsigned long long", most other hosts
+ have a sizetype of "unsigned long". Therefore choose the correct size
+ in mostly target independent way. */
+ if (TYPE_MODE (long_unsigned_type_node) == Pmode)
+ set_sizetype (long_unsigned_type_node);
+ else if (TYPE_MODE (long_long_unsigned_type_node) == Pmode)
+ set_sizetype (long_long_unsigned_type_node);
+ else
+ set_sizetype (long_unsigned_type_node);
build_common_tree_nodes_2 (0);
void_list_node = build_tree_list (NULL_TREE, void_type_node);
=
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-03 16:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23 15:49 ICE for fortran reasoned by wrong sizetype size for x86_64 mingw32 target Kai Tietz
2007-07-23 16:20 ` Paolo Bonzini
2007-07-24 7:15 ` Kai Tietz
2007-07-24 7:18 ` Paolo Bonzini
2007-07-27 13:06 ` Kai Tietz
2007-07-27 14:18 ` Paul Thomas
2007-07-30 8:42 Kai Tietz
[not found] <46ADB161.7030808@gmx.de>
2007-08-03 16:44 ` FX Coudert
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).