Tobias Schlüter - Re: [PATCH] PR fortran/24005 (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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] |
- From: Tobias Schlüter
- To: Steve Kargl
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Sep 2005 22:36:59 +0200
- Subject: Re: [PATCH] PR fortran/24005
- References: <20050922194925.GA59701@troutmask.apl.washington.edu>
Steve Kargl wrote:
The problem, again discussed in the PR, is that gfortran was passing a NULL pointer to strcmp.
OK for mainline?
This is not yet ok ...
--- 926,933 ---- if (p->sym == q->sym) continue; /* Duplicates OK here */
! if (p->sym->name && q->sym->name && p->sym->module && q->sym->module ! && strcmp (p->sym->name, q->sym->name) == 0 && strcmp (p->sym->module, q->sym->module) == 0) continue;
p->sym->name and q->sym->name should never be NULL. Furthermore, the module name needn't be set, as interfaces can reference symbols in the current scope, IOW the correct check would be:
if (strcmp (p->sym->name, q->sym->name) == 0 && ((!p->sym->module && !q->sym->module) || (p->sym->module && q->sym->module && strcmp (p->sym->module, q->sym->module) == 0)))
NB I remember that we stumbled across a very similar bug when I introduced the string table changes, which it turned out I had missed, because glibc's strcmp does "the right thing" with NULL arguments unlike FreeBSD's. Alternatively, (if I understand C well enough) we could simply compare the string pointers (they're allocated by gfc_get_string) like so:
if (p->sym->name == q->sym->name && p->sym->module == q->sym->module)
- Tobi
- Follow-Ups:
- Re: [PATCH] PR fortran/24005
* From: Steve Kargl - Re: [PATCH] PR fortran/24005
* From: Paul Thomas
- Re: [PATCH] PR fortran/24005
- References:
- [PATCH] PR fortran/24005
* From: Steve Kargl
- [PATCH] PR fortran/24005
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |