--- Comment #11 from scottwood at freescale dot com 2008-05-13 21:13
---
(In reply to comment #4)
> If your code invokes undefined behavior, how is gcc going
> to read your mind?
If GCC can tell that it is undefined behavior, then warning the user is more
useful than silently producing
--- Comment #10 from pinskia at gcc dot gnu dot org 2008-05-13 20:02
---
*** Bug 36232 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What|Removed |Added
-
--- Comment #9 from rguenth at gcc dot gnu dot org 2008-05-07 19:42 ---
decrementing a NULL pointer invokes undefined behavior, incrementing not.
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
---
--- Comment #8 from cyprien+gccbug at cypou dot net 2008-05-04 20:13
---
On some embedded machines, the SDRAM lays on 0x address. So it is not
so meaningless to increment or decrement from/to NULL pointer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124
--- Comment #7 from cyprien+gccbug at cypou dot net 2008-05-04 17:31
---
it's right, using --foo unstead of foo-- gives a better result.
But it does not make me happy (about the possibility of a bug)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124
--- Comment #6 from pinskia at gcc dot gnu dot org 2008-05-04 17:09 ---
>Now, this code should not rely on undefined behaviour:
It does because incrementing or decrementing to a NULL Pointer is undefined.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124
--- Comment #5 from cyprien+gccbug at cypou dot net 2008-05-04 17:03
---
Now, this code should not rely on undefined behaviour:
extern void func(int,void*);
void test()
{
register long *foo = (long*) (4*sizeof(*foo)) - 1;
register int index;
for(index=0;index<4;index++)
--- Comment #4 from kargl at gcc dot gnu dot org 2008-05-04 17:01 ---
(In reply to comment #2)
> shouldn't gcc report a warning in this case ?
>
> because silently entering an infinite loop is not very kind...
>
If your code invokes undefined behavior, how is gcc going
to read your mi
--- Comment #3 from pinskia at gcc dot gnu dot org 2008-05-04 16:45 ---
(In reply to comment #2)
> shouldn't gcc report a warning in this case ?
Maybe, but really depending on undefined behavior is bad too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124
--- Comment #2 from cyprien+gccbug at cypou dot net 2008-05-04 16:41
---
shouldn't gcc report a warning in this case ?
because silently entering an infinite loop is not very kind...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-05-04 16:34 ---
Pointers types overflow is undefined which is what you are seeing.
--
pinskia at gcc dot gnu dot org changed:
What|Removed |Added
--
11 matches
Mail list logo