public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl dot washington dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/19168] New: Mismatched KINDs in SELECT CASE constucts is not handled correctly Date: Mon, 27 Dec 2004 17:40:00 -0000 [thread overview] Message-ID: <20041227174001.19168.sgk@troutmask.apl.washington.edu> (raw) Consider this program posted by James Van Buskirk in c.l.f. gfortran currently issues an error because the KIND of 7 and 200 do not match the KIND of x. program case_ex implicit none integer, parameter :: ik1 = selected_int_kind(2) integer(ik1) x integer io write(*,'(a)',advance='no',iostat=io) ' Enter the value of x:> ' read(*,*) x if(io /= 0) x = 0 select case(x) case(7) write(*,'(a)') ' Sorry, bad guess.' case(200) write(*,'(a)') ' You win the prize!' case default write(*,'(a)') ' You aren''t even trying.' end select end program case_ex The relevant constraint from the Fortran standard is C805 (R808) For a given case-construct, each case-value shall be of the same type as case-expr. For character type, length differences are allowed, but the kind type parameters shall be the same. */ and we note no such requirement of the KIND for INTEGER and LOGICAL variables must match. In the discussion on c.l.f, Richard Maine pointed out that the normal promotion rules for numeric rational operation should be followed. An initial patch was posted to http://gcc.gnu.org/ml/fortran/2004-12/msg00179.html but it was deemed incorrect. -- steve -- Summary: Mismatched KINDs in SELECT CASE constucts is not handled correctly Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sgk at troutmask dot apl dot washington dot edu CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19168
next reply other threads:[~2004-12-27 17:40 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-12-27 17:40 sgk at troutmask dot apl dot washington dot edu [this message] 2004-12-27 17:56 ` [Bug fortran/19168] " sgk at troutmask dot apl dot washington dot edu 2005-01-01 21:57 ` sgk at troutmask dot apl dot washington dot edu 2005-01-09 4:55 ` giovannibajo at libero dot it 2005-01-16 12:51 ` cvs-commit at gcc dot gnu dot org 2005-01-16 13:04 ` pbrook at gcc dot gnu dot org 2005-01-16 16:04 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20041227174001.19168.sgk@troutmask.apl.washington.edu \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).