[Bug c/48545] New: dereferencing does not work as expected

2011-04-10 Thread gerald at itzgrund dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48545

   Summary: dereferencing does not work as expected
   Product: gcc
   Version: 4.4.4
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ger...@itzgrund.net


Created attachment 23940
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23940
minimum example of the problem

Dear gcc team,

I think I've found a bug on dereferncing pointers. An example is attached. The
problem exists inside the function outputfunc where the parameter output will
not be dereferenced as expected. You only have to compile the example and take
look at the output. There is a workaround that is also included inside the
example code of outputfunc (variable validoutput).

I hope that I did not overlook something inside the C-Standard but I think the
parameter output should be dereferenced just like the way it is done for
validoutput.

Best regards,
Gerald


[Bug c/48545] dereferencing does not work as expected

2011-04-11 Thread gerald at itzgrund dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48545

--- Comment #3 from Gerald Lutter  2011-04-11 
16:42:16 UTC ---
Hi Dmitry,

sorry for referring to you as a team :-) but I still think that dereferencing
should not be ignored like it is done for *output:

output: 0x22cd24
validoutput: 0x22cd24
*output: 0x22cd24
*validoutput: 0x40200c
(*output)[0]: 12
(*output)[1]: 32
(*output)[2]: 64
(*validoutput)[0]: 7
(*validoutput)[1]: 8
(*validoutput)[2]: 9

In my opinion it is not possible that the
printf("output: %p\n", output);
gives the same result as
printf("*output: %p\n", *output);

Best regards,
Gerald