------- Comment #2 from akr at m17n dot org 2008-03-03 23:45 ------- (In reply to comment #1) > nelem*sizeof(long) > > Wraps so what do you expect? This is the correct behavior really.
Oops. It wrapped. But changing the type of nelem to size_t doesn't change the situation. nelem * sizeof(long) < 2**32, so it doesn't wraps size_t. Anyway malloc's argument is size_t. So we can pass a size bigger than 2**31 bytes and malloc can allocates it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35427