This is the mail archive of the gcc-bugs@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]

[Bug c++/18905] New: Strange error: subscripted value is neither array nor pointer


With gcc 4.0.0 from today (December 9, 2004), I receive the error message 
 
error: subscripted value is neither array nor pointer 
 
for a piece of code that looks fine and is accepted by Intel's icc.  Some 
relevant lines seem to be e.g. 
 
 const char* const coords = "xyz"; 
 for (int d=0; d<D-1; ++d) os << "i" << coords[d] << " "; os << "i" << 
coords[D-1]; 
 
which looks as if there was a problem indexing the "coords" string. 
 
I compile with the options 
 
$ /home/eschnett/gcc/bin/g++ -ftrapv -march=pentium4 -malign-double -g3 -c 
ioascii.ii 
 
and the screen output is 
 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc: 
In static member function 'static int 
CarpetIOASCII::IOASCII<outdim>::OutputVarAs(const cGH*, const char*, const 
char*)': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:460: 
error: subscripted value is neither array nor pointer 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc: 
In function 'void CarpetIOASCII::WriteASCII(std::ostream&, const gdata<D>*, 
const bbox<int, D>&, int, int, const vect<int, D>&, const vect<int, D>&, int, 
int, int, int, int, double, const vect<double, D>&, const vect<double, D>&)': 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1029: 
error: subscripted value is neither array nor pointer 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1029: 
error: subscripted value is neither array nor pointer 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1031: 
error: subscripted value is neither array nor pointer 
/home/eschnett/Calpha/Cactus/arrangements/Carpet/CarpetIOASCII/src/ioascii.cc:1031: 
error: subscripted value is neither array nor pointer

-- 
           Summary: Strange error: subscripted value is neither array nor
                    pointer
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18905


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]