This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Cheers to anyone who can crash my character-SELECT patch!
- From: FX Coudert <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at gmail dot com>
- Date: Wed, 4 Jul 2007 15:27:01 +0200
- Subject: Cheers to anyone who can crash my character-SELECT patch!
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:to:message-id:content-type:cc:subject:from:date:x-mailer; b=NLg3Z60qvCO3GBWuhq/AxMggPV/7I7tETVk6ZtFlZ5iAz/MVhC86IlPkpXPIaEqYct+PtDSelsp42+N+NMlvD4EnXKKfMn1zLApO/uGazSYLydZi0OPn2+QNjiwF92N91JY0VWkVTJlZzG6HbdIKsaIg/9oHaPRyUrI04HhOCyo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:to:message-id:content-type:cc:subject:from:date:x-mailer; b=JZhxcf2q4ArWRKtdklqNXCR/Fz95pkaT23YStA5/16qS4WN7V02DjAti+oiIsRNwcD09gdbBAJZMje3EVdP3BwzFN6mzbAfNq6Sv3vRdzow/wDvN6VXOcph8I2ok2eAeAlKI8AtjMeXYygRRKUGgXmP/FGEfIdkvJm8VUOlMbxc=
Hi all,
The patch attached is a partial rewrite of the translation of SELECT
for character types. I'd be very interested to see what people can
throw at it, and whether it handles it. I don't have a widely
creative imagination, so I think it would be good to have other
people helping me on this. (Plus, it's a good thing for those readers
who would like to do something for gfortran but don't actually have
time to sink into the compiler itself). Moreover, the current
testsuite doesn't test character SELECT, AFAICT. So, all testcases
and crashtests are welcome!
And now, the story behind the motivation for this reworking: I've
worked on bit this afternoon on rewriting the way we translate 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.
Thanks in advance for your help !
FX
Attachment:
select_character.diff
Description: Binary data