public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46454] New: Pointer to pointer function parameter handled incorrectly
@ 2010-11-12 19:15 taradov at gmail dot com
2010-11-12 19:36 ` [Bug middle-end/46454] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: taradov at gmail dot com @ 2010-11-12 19:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46454
Summary: Pointer to pointer function parameter handled
incorrectly
Product: gcc
Version: 4.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: taradov@gmail.com
Exact GCC version: gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
Program below when compiled with -O2 or higher produces output like:
------- 0x08724018 0x00000000 0x08724008
With -O1 it produces expected output:
------- 0x09917018 0x09917008 0x09917008
------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
typedef struct List_t
{
struct List_t *next;
} List_t;
typedef struct Symbol_t
{
struct Symbol_t *next;
} Symbol_t;
typedef struct First_t
{
Symbol_t *set;
} First_t;
static void list_add(void **list, void *element)
{
((List_t *)element)->next = NULL;
if (*list)
{
List_t *last = *list;
while (last->next)
last = last->next;
last->next = element;
}
else
*list = element;
}
int main(void)
{
First_t *item;
Symbol_t *res;
res = malloc(sizeof(Symbol_t));
res->next = NULL;
item = malloc(sizeof(struct First_t));
item->set = NULL;
list_add((void *)&item->set, res);
printf("------- 0x%08lx 0x%08lx 0x%08x\n", item, item->set, res);
return 0;
}
--------------------------------------
Bug seems to be fixed in 4.6.x branch, but present in 4.4.x and 4.5.x.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/46454] Pointer to pointer function parameter handled incorrectly
2010-11-12 19:15 [Bug c/46454] New: Pointer to pointer function parameter handled incorrectly taradov at gmail dot com
@ 2010-11-12 19:36 ` pinskia at gcc dot gnu.org
2010-11-12 20:04 ` [Bug c/46454] " taradov at gmail dot com
2010-11-12 23:31 ` [Bug middle-end/46454] " rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-11-12 19:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46454
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-12 19:14:39 UTC ---
I think this has aliasing violations in it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/46454] Pointer to pointer function parameter handled incorrectly
2010-11-12 19:15 [Bug c/46454] New: Pointer to pointer function parameter handled incorrectly taradov at gmail dot com
2010-11-12 19:36 ` [Bug middle-end/46454] " pinskia at gcc dot gnu.org
@ 2010-11-12 20:04 ` taradov at gmail dot com
2010-11-12 23:31 ` [Bug middle-end/46454] " rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: taradov at gmail dot com @ 2010-11-12 20:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46454
Alexander Taradov <taradov at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |c
--- Comment #2 from Alexander Taradov <taradov at gmail dot com> 2010-11-12 19:50:40 UTC ---
(In reply to comment #1)
> I think this has aliasing violations in it.
Yes, my bad.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/46454] Pointer to pointer function parameter handled incorrectly
2010-11-12 19:15 [Bug c/46454] New: Pointer to pointer function parameter handled incorrectly taradov at gmail dot com
2010-11-12 19:36 ` [Bug middle-end/46454] " pinskia at gcc dot gnu.org
2010-11-12 20:04 ` [Bug c/46454] " taradov at gmail dot com
@ 2010-11-12 23:31 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-12 23:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46454
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-12 23:28:54 UTC ---
see comment #2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-12 23:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12 19:15 [Bug c/46454] New: Pointer to pointer function parameter handled incorrectly taradov at gmail dot com
2010-11-12 19:36 ` [Bug middle-end/46454] " pinskia at gcc dot gnu.org
2010-11-12 20:04 ` [Bug c/46454] " taradov at gmail dot com
2010-11-12 23:31 ` [Bug middle-end/46454] " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).