public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49659] New: If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit).
@ 2011-07-06 10:26 alhoweling at yahoo dot de
2011-07-06 11:00 ` [Bug fortran/49659] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: alhoweling at yahoo dot de @ 2011-07-06 10:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49659
Summary: If-and-condition not obeyed using the g77-compiler
(Windows 7, 64-bit).
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: alhoweling@yahoo.de
Compiling and running the following short sourcecode:
***************************
PROGRAM TEST
INTEGER A,B,C
LOGICAL M
A=23
B=34
C=55
M=.FALSE.
IF (A.eq.23.AND.B.eq.34.and.C.eq.4.and.M.eqv..FALSE.) THEN
PRINT*, 'yes'
ELSE
PRINT*, 'no'
END IF
END
***************************
gives the following output:
yes
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49659] If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit).
2011-07-06 10:26 [Bug fortran/49659] New: If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit) alhoweling at yahoo dot de
@ 2011-07-06 11:00 ` rguenth at gcc dot gnu.org
2011-07-06 11:04 ` rguenth at gcc dot gnu.org
2011-07-06 12:02 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-06 11:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49659
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.07.06 11:00:29
Version|unknown |4.6.1
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-06 11:00:29 UTC ---
Confirmed.
PROGRAM TEST
INTEGER C
LOGICAL M
C=55
M=.FALSE.
IF (C.eq.4.and.M.eqv..FALSE.) THEN
PRINT*, 'yes'
ELSE
PRINT*, 'no'
END IF
END
has in .original:
c = 55;
m = 0;
if (c != 4 || !m)
{
{
struct __st_parameter_dt dt_parm.0;
dt_parm.0.common.filename = &"t.f"[1]{lb: 1 sz: 1};
dt_parm.0.common.line = 7;
dt_parm.0.common.flags = 128;
dt_parm.0.common.unit = 6;
_gfortran_st_write (&dt_parm.0);
_gfortran_transfer_character_write (&dt_parm.0, &"yes"[1]{lb: 1 sz: 1},
3);
_gfortran_st_write_done (&dt_parm.0);
}
}
somehow the condition is inverted but the branches are not exchanged
(it's also bogously inverted).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49659] If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit).
2011-07-06 10:26 [Bug fortran/49659] New: If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit) alhoweling at yahoo dot de
2011-07-06 11:00 ` [Bug fortran/49659] " rguenth at gcc dot gnu.org
@ 2011-07-06 11:04 ` rguenth at gcc dot gnu.org
2011-07-06 12:02 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-06 11:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49659
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-06 11:03:58 UTC ---
Strangely ifort outputs the same result, so it must be correct (thus,
your program is invalid). Works with
IF ((C.eq.4).and.(M.eqv..FALSE.)) THEN
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49659] If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit).
2011-07-06 10:26 [Bug fortran/49659] New: If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit) alhoweling at yahoo dot de
2011-07-06 11:00 ` [Bug fortran/49659] " rguenth at gcc dot gnu.org
2011-07-06 11:04 ` rguenth at gcc dot gnu.org
@ 2011-07-06 12:02 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-07-06 12:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49659
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-07-06 12:01:59 UTC ---
> Strangely ifort outputs the same result, so it must be correct ...
Indeed! The standard says
7.1.3 Precedence of operators
1 There is a precedence among the intrinsic and extension operations
corresponding to the form of expressions speci ed in 7.1.2, which
determines the order in which the operands are combined unless the order is
changed by the use of parentheses. This precedence order is summarized in
Table 7.2.
Table 7.2:
Categories of operations and relative precedence
Category of operation Operators Precedence
Extension defined-unary-op Highest
Numeric ** .
Numeric *, / .
Numeric unary +, - .
Numeric binary +, - .
Character // .
Relational .EQ., .NE., .LT.,
.LE., .GT., .GE.,
==, /=, <, <=, >,
>= .
Logical .NOT. .
Logical .AND. .
Logical .OR. .
Logical .EQV., .NEQV. .
Extension defined-binary-op Lowest
>From this table 'C.eq.4.and.M.eqv..FALSE.' is computed as
'((C.eq.4).and.M).eqv..FALSE)' which is .TRUE..
> (thus, your program is invalid).
The program is not invalid, but the reporter expectation is.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-06 12:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-06 10:26 [Bug fortran/49659] New: If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit) alhoweling at yahoo dot de
2011-07-06 11:00 ` [Bug fortran/49659] " rguenth at gcc dot gnu.org
2011-07-06 11:04 ` rguenth at gcc dot gnu.org
2011-07-06 12:02 ` dominiq at lps dot ens.fr
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).