------- Comment #6 from burnus at gcc dot gnu dot org 2006-11-02 16:32 ------- Created an attachment (id=12536) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12536&action=view) Revised idea how libgfortran/intrinsic/system_clock.c could look like
The latter part is of cause not completely right if count_rate = 1 or 1000000, and for an error int16 and real counts didn't contain -huge(). Maybe having in the library a system_clock_4 version makes life easier. The following pseudocode should then work with system_clock_4 and system_clock_8 (which has also the advantage that we don't modify the library which is nice in terms of compatibility :-) if ( (counts != NULL && counts.type == 4) ||(count_max != NULL && count_max.type == 4) { if(count != NULL && counts.type != 4) gfc_convert_type() if(count != NULL && count_max.type != 4) gfc_convert_type() if(count != NULL && count_rate.type != 4) gfc_convert_type() c->resolved_sym = gfc_get_intrinsic_sub_symbol ("system_clock_4") if (counts != NULL && counts.type != 4) add_expression("if(counts4 < 0) counts = -huge_max(type)" "else counts = (type) counts4") if (count_rate != NULL && count_rate.type != 4) count_rate = (type) count_rate4 if (count_max != NULL && count_max.type != 4) count_rate = (type) count_rate4 } else { if(count != NULL && counts.type != 8) gfc_convert_type() if(count != NULL && count_max.type != 8) gfc_convert_type() if(count != NULL && count_rate.type != 8) gfc_convert_type() c->resolved_sym = gfc_get_intrinsic_sub_symbol ("system_clock_8") if (counts != NULL && counts.type != 8) add_expression("if(counts8 < 0) counts = -huge_max(type)" "else counts = (type) counts8") if (count_rate != NULL && count_rate.type != 8) count_rate = (type) count_rate8 if (count_max != NULL && count_max.type != 8) count_rate = (type) count_rate8 } Now I only have to figure out how to add the conversion and the "if(counts8 < 0)" expression in iresolve.c. -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12535|0 |1 is obsolete| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28484