Bug 7388 - Incorrect output with 0 based array of characters.
Summary: Incorrect output with 0 based array of characters.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Toon Moene
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-23 13:36 UTC by Toon Moene
Modified: 2003-09-23 22:14 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toon Moene 2002-07-23 13:36:00 UTC
This code:

      character*256 buff(0:10)
      character*80 strings(10)
      integer i,m1,m2

      i = 1
      m1 = 1
      m2 = 7
      buff(i) = 'tcase0a'
      strings(i) = buff(i)(m1:m2)
      write(*,*)buff(i)
      write(*,*)buff(i)(m1:m2)
      write(*,*)strings(i)

      stop
      end

should print "tcase0a" three times, the first time with 248
blanks attached.

However, with 'g77 [other options] -fbounds-check' it
doesn't.

Release:
3.1

Environment:
Linux, probably unimportant
Comment 1 Toon Moene 2002-09-28 08:29:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Analysed, test case added to g77.dg directory as 7388.f.
    
    Might not be a frontend problem, as it doesn't fail on all
    targets (specifically, sparc64).
Comment 2 Hans-Peter Nilsson 2002-09-28 13:40:11 UTC
From: Hans-Peter Nilsson <hp@bitrange.com>
To: Moene <toon@moene.indiv.nluug.nl>,  <allan@rolls-royce.ca>, 
     <gcc-bugs@gcc.gnu.org>,  <gcc-prs@gcc.gnu.org>, 
     <george@geo.titech.ac.jp>,  <nobody@gcc.gnu.org>, 
     <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: fortran/7388: Incorrect output with 0 based array of characters.
Date: Sat, 28 Sep 2002 13:40:11 -0400 (EDT)

 For the record, g77.dg/7388.f fails on mmix-knuth-mmixware too.
 
 
Comment 3 Toon Moene 2002-10-26 09:01:25 UTC
Responsible-Changed-From-To: unassigned->toon
Responsible-Changed-Why: Fortran Maintainer.
Comment 4 Toon Moene 2002-10-26 09:01:25 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in 3.2.1 and 3.3.
    
    Probably by Nathan Sidwell, fixing PR c++/7209:
    
    * fold_const.c (fold_binary_op_with_conditional_arg):
      Alwasy build compound_expr if we used save_expr.