[gfortran,patch] Improve handling of character SELECT
FX Coudert
fxcoudert@gmail.com
Wed Jul 11 21:34:00 GMT 2007
The patch attached is a partial rewrite of the translation of SELECT
for character types. Currently, we generate a blocks of code for each
case, along with a label and a list of the cases; a library function
is called and it returns the address of the label that we will jump
to. This use of jumps (GOTO_EXPR) is apparently hard on the middle-
end (probably causing missed-optimizations, and at least preventing
it to correctly understand what variables are initialized: see PR
32035). Andrew Pinski suggested that we can use a SWITCH_EXPR instead
(thanks Andrew for the analysis!). This is what my patch does, by
assiging an integer value to each case, making the library function
return an integer value and using a switch to select the appropriate
code block to execute.
Bootstrapped and regtested on x86_64-linux, OK for mainline?
:ADDPATCH fortran:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_char.ChangeLog
Type: application/octet-stream
Size: 602 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070711/f0549711/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: select_char.diff
Type: application/octet-stream
Size: 8322 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070711/f0549711/attachment-0001.obj>
More information about the Fortran
mailing list