Hi Mikael, at first I tried to fix this issue with the scalarizer, too, but I could not grasp how the scalarizer was working. Do you have any documentation, how it is meant to be? I mean, I have read the comments in the code, but those are sparse and the multitude of routines the scalarizer is split up into doesn't help either.
Anyway, because not a single line of code from my patch is left, this has to be your patch now. Thanks for finding a better solution. I do not have the privileges to do a review so I can't help you there. Good luck finding a reviewer. Regards, Andre On Thu, 07 May 2015 18:35:19 +0200 Mikael Morin <mikael.mo...@sfr.fr> wrote: > Le 07/05/2015 11:52, Andre Vehreschild a écrit : > > Hi all, > > > > my work on pr60322 caused a regression on trunk. This patch fixes it. The > > regression had two causes: > > 1. Not taking the correct attribute for BT_CLASS objects with allocatable > > components into account (chunk 1), and > > 2. taking the address of an address (chunk 2). When a class or derived typed > > scalar object is to be returned as a reference and a scalarizer is > > present, then the address of the address of the object was returned. The > > former code was meant to return the address of an array element for which > > taking the address was ok. The patch now prevents taking the additional > > address when the object is scalar. > > > Hello, > > The "chunk 2" fix should go in gfc_conv_expr, so that > gfc_add_loop_ss_code's "can_be_null_ref" condition matches the one in > gfc_conv_expr. Both functions work together, if references are > generated in gfc_add_loop_ss_code, they should be used as reference in > gfc_conv_expr. Same if values are generated. > > About the condition of the first chunk, I don't understand what it's > good for. > > So I propose the attached patch instead. > It creates a new function to decide between reference and value, so that > gfc_add_loop_ss_code and gfc_conv_expr are kept in sync. > As the new function needs information about the dummy argument, the > dummy symbol is saved to a new field in gfc_ss_info. > And the "chunk 1" condition is reverted to its previous state. > The testcase is yours. > > regression tested on x86_64-unknown-linux-gnu. OK for trunk? > > Mikael > > > > > -- Andre Vehreschild * Email: vehre ad gmx dot de