This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Sorry if this was sent twice (I was not subscribed to list the first time) Hi all concerned, Looking at the sources of 2.95.1 of gcc, I have noticed that with -fugly-logint option all operations involving logicals would first cast logical to int except for logical operations. Now adding the casting section to the function that is called for logical operations fixes the issue I had before: bug #`fortran/6491'. Here is a patch. Now I'd love if someone knowledgeable took a look at it to check if it's crappy, dangerous, erroneous, stupid or what. My knowledge of compilators being non-existent, and of coding in general very limited. Thanks Attachments: 1- The patch 2- Original message to gcc-help with 3- example Fortran File showing problem.
diff -cr gcc-2.95.1/gcc/f/expr.c gcc-2.95.1_hassan/gcc/f/expr.c *** gcc-2.95.1/gcc/f/expr.c Sat May 15 11:46:08 1999 --- gcc-2.95.1_hassan/gcc/f/expr.c Tue May 7 14:51:56 2002 *************** *** 11495,11501 **** --- 11495,11520 ---- } /* else Leave it alone. */ } + /* Hassan's Temporary Addition to Fix logical and/or... */ + if (lbt == FFEINFO_basictypeLOGICAL) + { + ffebld_set_left (reduced, ffeexpr_convert (ffebld_left (reduced), + l->token, op->token, FFEINFO_basictypeINTEGER, + FFEINFO_kindtypeINTEGERDEFAULT, 0, + FFETARGET_charactersizeNONE, + FFEEXPR_contextLET)); + } + if (rbt == FFEINFO_basictypeLOGICAL) + { + ffebld_set_right (reduced, ffeexpr_convert (ffebld_right (reduced), + r->token, op->token, FFEINFO_basictypeINTEGER, + FFEINFO_kindtypeINTEGERDEFAULT, 0, + FFETARGET_charactersizeNONE, + FFEEXPR_contextLET)); + } + + /* End Of Hassan's Temporary Addition */ return reduced; }
Attachment:
g77_logical_error_message
Description: Text document
program parallel logical*4 l4, ll4 logical*1 l1(4), ll1(4) logical*4 true /X'01010101'/ integer i equivalence(l1, l4), (ll1, ll4) C Setting first and third elements of logical*4 to true ll1(1) = .true. ll1(3) = .true. C Using normal .and. operator l4 = ll4 .and. true do i =1, 4 print *, l1(i) enddo C Now using and(.,.) operator. The same applies for OR/XOR ... l4 = and(ll4, true) do i =1, 4 print *, l1(i) enddo end
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |