This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug report: ternary operator + new
- To: egcs-bugs at cygnus dot com
- Subject: Bug report: ternary operator + new
- From: Eric Bischoff <ebisch at cybercable dot tm dot fr>
- Date: Mon, 9 Nov 1998 00:02:45 +0100
Hello,
The following code produces an internal compiler error:
=================================================================================
// Fonction privée de détermination du numéro d'ordre de la fiche à un certainoffset d'une liste
// Renvoie TRUE si tout s'est bien passé
BOOLEAN CApplicationHTML::NumeroOrdreFicheListe
(CSortieHTML *sortieHTML,
CFormatPresentation *formatPresentation,
BOOLEAN choisieParUtilisateur,
const CListeFiches *listeFiches, long offsetFiche, long &numeroOrdre)
{ CListeFichesIterateur *prochaineFiche; // Itérateur sur les fiches de la liste examinée
long offsetTeste; // Offset de la fiche de la liste examinée
if (!(prochaineFiche = // On alloue l'itérateur sur les fiches de la liste examinée
listeFiches->ListeTriee?
(CListeFichesIterateur *) new CListeNonTrieeIterateur(*(const CListeNonTriee *) listeFiches):
(CListeFichesIterateur *) new CListeTrieeIterateur(*(const CListeTriee *) listeFiches)))
{ Erreur(sortieHTML, formatPresentation, FALSE, M_Erreur_changement_fiche);
return FALSE;
}
for (numeroOrdre = 0L; // On compte les fiches précédant celle dont on connait l'offset
offsetTeste = (*prochaineFiche)();
numeroOrdre++)
{ if (offsetTeste == offsetFiche) // On s'arrête quand on a trouvée celle dont on connaît l'offset
{ delete prochaineFiche;
return TRUE;
}
}
delete prochaineFiche;
Erreur(sortieHTML, formatPresentation, choisieParUtilisateur, M_Erreur_fiche_non_affichee);
return FALSE;
}
=================================================================================
Here comes the compile command:
=================================================================================
gcc -I /home/eric/portage/gesbib5 -I
/home/eric/portage/xvtdsp45/lin_ppc/include -I
/home/eric/portage/apache-fastcgi/include -c
/home/eric/portage/gesbib5/Web/CAppHtml.cpp -o
/home/eric/portage/gesbib5/Web/ProjetM/CAppHtml.o
/home/eric/portage/gesbib5/Web/CAppHtml.cpp: In method `short int
CApplicationHTML::NumeroOrdreFicheListe(class CSortieHTML *, class
CFormatPresentation *, short int, const class CListeFiches *, long int, long
int &)':
/home/eric/portage/gesbib5/Web/CAppHtml.cpp:296: Internal compiler error.
/home/eric/portage/gesbib5/Web/CAppHtml.cpp:296: Please submit a full
bug report to `egcs-bugs@cygnus.com'.
=================================================================================
The line number 296 is the one where there is an assignation through the
ternary operator ?: of a pointer (prochaineFiche) to a new object.
The heritage tree of the newly allocated objects is a follows:
CListeFichesIterateur --+-- CListeTrieeIterateur
!
+-- CListeNonTrieeIterateur
That code works fine with other compilers: Metrowerks CodeWarrior (Macintosh)
and Visual C++ (Windows).
My gcc version is:
egcs-2.90.25 980302 (egcs-1.0.2 prerelease)
I'm running MkLinux 2.0.33 on a Power Macintosh.
I hope this helps.
---
Eric Bischoff
mailt:ebisch@cybercable.tm.fr