[Bug c/79979] New: For loop fails to exit

2017-03-09 Thread jdowdells at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

Bug ID: 79979
   Summary: For loop fails to exit
   Product: gcc
   Version: 4.8.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jdowdells at hotmail dot com
  Target Milestone: ---

Created attachment 40938
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40938&action=edit
Test code which shows this issue

When I compile this code:


#include 
#include 
#include 
#include 

typedef enum
{
e_0,
e_1,
e_2,
e_3,
e_4,
e_5,
e_6,
e_7,
e_8,
e_9
};

int dummy_array[8];

int main(void)
{
int x = dummy_array[8];
 e;


printf("X = %d\n", x);
printf("address of dummy_array[0] = %p\n", &dummy_array[0]);
printf("address of dummy_array[100] = %p\n", &dummy_array[100]);

for (e = e_0; e

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jdowdells at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

--- Comment #2 from jdowdells at hotmail dot com ---
Thanks for your quick reply.

However, this is not intuitive, the compiler should be "free to do anything" in
a sensible intuitive manner.

The for loop is well defined and there is no conceivable circumstance that
should allow it to loop forever.

The optimized/unoptimized code should work the same but it does not.

If you want to make the unoptimized code loop for ever I'll be more than happy

Thanks again.

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jdowdells at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

jdowdells at hotmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #5 from jdowdells at hotmail dot com ---
Thanks for your feedback.