Bug 6491 - [3.3/3.4 Regression] [g77] Logical operations error on logicals when using -fugly-logint
Summary: [3.3/3.4 Regression] [g77] Logical operations error on logicals when using -...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 2.95.1
: P3 normal
Target Milestone: 3.4.0
Assignee: aurag
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2002-04-27 14:06 UTC by aurag
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
ands1.f (280 bytes, application/octet-stream)
2003-05-21 15:17 UTC, aurag
Details
This is a modified expr.c that correctly immitates IBM's xlf -qintlog (63.31 KB, application/x-zip-compressed)
2003-11-25 10:49 UTC, aurag
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aurag 2002-04-27 14:06:00 UTC
Doing parallel byte operations with and's, or's fails to run correctly when using --fugly-logint.

The file below is good example of how a.and.b works differently from and(a,b)

Please compile example with g77 -fugly-logint

Release:
gcc version 2.95.1 19990816 (release)/GNU Fortran 0.5.25 19990816 (release)

Environment:
Linux ibdu 2.2.12-20 #1 Fri Sep 29 07:29:24 EDT 2000 i686 unknown(RedHat 6.1)

How-To-Repeat:
Just compile file with -fugly-logint and run to see difference between 2 outputs.
Comment 1 aurag 2002-04-27 14:06:00 UTC
Fix:
I have no idea, except that .and. should behave as and(.,.) in my opinion. But I am no expert.
Comment 2 Toon Moene 2002-05-09 02:17:36 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed by submitter for 3.2
    See: http://gcc.gnu.org/ml/gcc-patches/2002-05/msg00826.html
Comment 3 Toon Moene 2003-11-24 21:58:22 UTC
I have to reopen this bug, because the proposed (and implemented) solution
caused regression (cf. PR fortran/12633).
Comment 4 aurag 2003-11-25 10:49:34 UTC
Created attachment 5211 [details]
This is a modified expr.c that correctly immitates IBM's xlf -qintlog

This should fix the mentionned problem. I had it for a while but forgot to
submit it. Sorry
Comment 5 aurag 2003-11-25 10:51:21 UTC
The Expr.zip attachement above contains a modified expr.c file replacing 
gcc/f/expr.c

This should correctly handle all logical operations and still implements IBM's 
xlf -qintlog.

It's not the best looking code but it works
Comment 6 Toon Moene 2003-11-25 22:15:30 UTC
Nope, this doesn't fix the test case of PR 12633.
Comment 7 aurag 2003-11-27 17:04:21 UTC
I will look at this asap, and come back with a solution (hopefully).

Comment 8 Andrew Pinski 2003-11-27 21:52:04 UTC
Assigning who thought he assigned it to himself.
Comment 9 Andrew Pinski 2003-12-23 09:25:34 UTC
Mark it right as the patch which fixed this caused other problems so it was reverted for 
3.3.3 and 3.4.
Comment 10 Andrew Pinski 2003-12-23 09:26:16 UTC
Mark it right as the patch which fixed this caused other problems so it was reverted for 
3.3.3 and 3.4.
Comment 11 Ian Lance Taylor 2004-01-12 19:20:57 UTC
I posted a potential patch here:
http://gcc.gnu.org/ml/fortran/2004-01/msg00080.html

This needs to be examined by somebody more familiar with FORTRAN.
Comment 12 aurag 2004-01-12 19:59:17 UTC
(In reply to comment #11)
> I posted a potential patch here:
> http://gcc.gnu.org/ml/fortran/2004-01/msg00080.html
> 
> This needs to be examined by somebody more familiar with FORTRAN.

I will compile this and test it and have a look.

Thanks for the patch
Comment 13 CVS Commits 2004-01-14 02:32:56 UTC
Subject: Bug 6491

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ian@gcc.gnu.org	2004-01-14 02:32:50

Modified files:
	gcc/f          : ChangeLog expr.c 

Log message:
	PR fortran/6491
	* expr.c (ffeexpr_reduce_): When handling AND, OR, and XOR, and
	when using -fugly-logint, if both operands are logical, convert
	the result back to logical.
	(ffeexpr_reduced_ugly2log_): Add bothlogical parameter.  Change
	all callers.  Convert logical operands to integer.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/ChangeLog.diff?cvsroot=gcc&r1=1.620&r2=1.621
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/expr.c.diff?cvsroot=gcc&r1=1.30&r2=1.31

Comment 14 Andrew Pinski 2004-01-14 03:05:07 UTC
Fixed for 3.4.