This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Steve, > > gfc_match_intrinsic and gfc_match_external work for attributes > in a single statement, ie., > > real, intrinsic, external :: x Yes, indeed. > > will trigger an error. OTOH, the INTRINSIC and EXTERNAL statements > do not (apparently) go through the check_conflict routine. I spent > a few hours today trying to see how these statements work and simply > haven't figured out how either is parsed with respect to setting > the attributes. I have had the same experience; I decided to fix that - see below: > Well, it is obviously not done for us, or I won't have added the > code to resolve.c :-) I'll look at it some more tomorrow. Time for > some sleep. Sorry, I was not trying to be sarcastic - just overstating the obvious! How it works: (decl.c), for example 03375 match 03376 gfc_match_optional (void) 03377 { 03378 03379 gfc_clear_attr (¤t_attr); 03380 gfc_add_optional (¤t_attr, NULL); 03381 03382 return attr_decl (); 03383 } line 3380 does nothing, following the previous gfc_clear_attr, that could not be done with: current_attr.optional = 1; The checks that are made do nothing because this is the only attribute set. All the action happens in attr_decl () - this parses the rest of the statement. Adding the check here fixes all these attribute statements and reduces a the number of spurious calls to check_used, check_conflict and check_done. With the checks performed at the end of attr_decl1, your testcase produces: In file ext_int.f90:3 external :: nint 1 Error: EXTERNAL attribute conflicts with INTRINSIC attribute at (1) The patch is attached and regtests OK on Cygwin_NT. I presume that it fixes other PRs of the same kind but have not had time to look. Best regards Paul
Attachment:
attr.diff
Description: attr.diff
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |