This is the mail archive of the gcc@gcc.gnu.org mailing 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] | |
"Jie Zhang" <jzhang918@gmail.com> writes:
> But now gcc seems to optimize it away. For the following function:
>
> $ cat t.c
> #include <limits.h>
> void foo (int rc)
> {
> int x = rc / INT_MAX;
> x = 4 / x;
> }
I believe we still keep division by zero in general. In your example
it gets optimized away because it is dead code. Nothing uses x.
Ian
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |