| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-g" } */ |
| 3 |
|
| 4 |
typedef long unsigned int size_t; |
| 5 |
typedef signed int __int32_t; |
| 6 |
typedef __int32_t int32_t; |
| 7 |
typedef long int ptrdiff_t; |
| 8 |
typedef enum { |
| 9 |
BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX, BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID, BT_ASSUMED, BT_UNION, BT_BOZ } bt; |
| 10 |
typedef int32_t GFC_INTEGER_4; |
| 11 |
typedef ptrdiff_t index_type; |
| 12 |
typedef size_t gfc_charlen_type; |
| 13 |
typedef struct descriptor_dimension { |
| 14 |
index_type _stride; |
| 15 |
index_type lower_bound; |
| 16 |
} descriptor_dimension; |
| 17 |
typedef struct { |
| 18 |
descriptor_dimension dim[15]; |
| 19 |
} gfc_full_array_i4; |
| 20 |
typedef void (*formatted_dtio)(void *, GFC_INTEGER_4 *, char *, gfc_full_array_i4 *, GFC_INTEGER_4 *, char *, gfc_charlen_type, gfc_charlen_type); |
| 21 |
typedef enum { DECIMAL_POINT, DECIMAL_COMMA, DECIMAL_UNSPECIFIED } unit_decimal; |
| 22 |
typedef struct st_parameter_dt { |
| 23 |
union { |
| 24 |
struct { |
| 25 |
struct gfc_unit *current_unit; |
| 26 |
unsigned namelist_mode : 1; |
| 27 |
unsigned unit_is_internal : 1; |
| 28 |
formatted_dtio fdtio_ptr; |
| 29 |
} p; |
| 30 |
} u; |
| 31 |
} st_parameter_dt; |
| 32 |
typedef struct gfc_unit { |
| 33 |
int unit_number; |
| 34 |
unit_decimal decimal_status; |
| 35 |
int (*next_char_fn_ptr) (st_parameter_dt *); |
| 36 |
void (*push_char_fn_ptr) (st_parameter_dt *, int); |
| 37 |
} gfc_unit; |
| 38 |
void read_real (st_parameter_dt *dtp) |
| 39 |
{ |
| 40 |
int c; |
| 41 |
int seen_dp; |
| 42 |
seen_dp = 0; |
| 43 |
for (;;) |
| 44 |
{ |
| 45 |
c = ((dtp)->u.p.current_unit->next_char_fn_ptr (dtp)); |
| 46 |
if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA) |
| 47 |
c = '.'; |
| 48 |
switch (c) { |
| 49 |
case '.': |
| 50 |
if (seen_dp) goto bad_real; |
| 51 |
seen_dp = 1; |
| 52 |
((dtp)->u.p.current_unit->push_char_fn_ptr (dtp, c)); |
| 53 |
goto real_loop; |
| 54 |
case 'E': |
| 55 |
case 'e': |
| 56 |
case 'D': |
| 57 |
case 'd': |
| 58 |
case 'Q': |
| 59 |
case 'q': |
| 60 |
goto exp1; |
| 61 |
case '+': |
| 62 |
case '-': |
| 63 |
((dtp)->u.p.current_unit->push_char_fn_ptr (dtp, 'e')); |
| 64 |
goto got_repeat; |
| 65 |
} |
| 66 |
} |
| 67 |
got_repeat: |
| 68 |
real_loop: |
| 69 |
for (;;) |
| 70 |
{ |
| 71 |
c = ((dtp)->u.p.current_unit->next_char_fn_ptr (dtp)); |
| 72 |
switch (c) { |
| 73 |
case '.': |
| 74 |
if (seen_dp) goto bad_real; |
| 75 |
seen_dp = 1; |
| 76 |
((dtp)->u.p.current_unit->push_char_fn_ptr (dtp, c)); |
| 77 |
} |
| 78 |
} |
| 79 |
exp1: |
| 80 |
bad_real: |
| 81 |
return; |
| 82 |
} |