diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-07 15:12:06 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-07 15:12:06 +0000 |
commit | 4d6b4af65ce0546fcdb9d0b96f9ab18c0c805b40 (patch) | |
tree | 574bfaa034b15098befcc64f0fa9d316cfc1f980 /gcc/fortran/primary.c | |
parent | d4e3bde0c9f0593b5b1e070e5516f3b6b5935d01 (diff) | |
download | gcc-4d6b4af65ce0546fcdb9d0b96f9ab18c0c805b40.tar.gz |
fortran/
* primary.c (match_boz_constant): Allow kind parameter suffixes.
Move standard warning further to the front.
testsuite/
* gfortran.fortran-torture/execute/intrinsic_mvbits.f90,
gfortran.dg/ishft.f90: Add more tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88690 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 45348e6a760..fe6645de21e 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -235,7 +235,7 @@ match_integer_constant (gfc_expr ** result, int signflag) static match match_boz_constant (gfc_expr ** result) { - int radix, delim, length, x_hex; + int radix, delim, length, x_hex, kind; locus old_loc; char *buffer; gfc_expr *e; @@ -272,6 +272,12 @@ match_boz_constant (gfc_expr ** result) if (delim != '\'' && delim != '\"') goto backup; + if (x_hex && pedantic + && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal " + "constant at %C uses non-standard syntax.") + == FAILURE)) + return MATCH_ERROR; + old_loc = gfc_current_locus; length = match_digits (0, radix, NULL); @@ -293,25 +299,25 @@ match_boz_constant (gfc_expr ** result) memset (buffer, '\0', length + 1); match_digits (0, radix, buffer); - gfc_next_char (); + gfc_next_char (); /* Eat delimiter. */ + + kind = get_kind (); + if (kind == -1) + return MATCH_ERROR; + if (kind == -2) + kind = gfc_default_integer_kind; + else if (pedantic + && (gfc_notify_std (GFC_STD_GNU, "Extension: Kind parameter " + "suffix to boz literal constant at %C.") + == FAILURE)) + return MATCH_ERROR; - e = gfc_convert_integer (buffer, gfc_default_integer_kind, radix, - &gfc_current_locus); + e = gfc_convert_integer (buffer, kind, radix, &gfc_current_locus); if (gfc_range_check (e) != ARITH_OK) { - gfc_error ("Integer too big for default integer kind at %C"); - - gfc_free_expr (e); - return MATCH_ERROR; - } + gfc_error ("Integer too big for integer kind %i at %C", kind); - if (x_hex - && pedantic - && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal " - "constant at %C uses non-standard syntax.") - == FAILURE)) - { gfc_free_expr (e); return MATCH_ERROR; } |