Skip to content

Instantly share code, notes, and snippets.

@rofirrim
Created January 30, 2013 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rofirrim/4674748 to your computer and use it in GitHub Desktop.
Save rofirrim/4674748 to your computer and use it in GitHub Desktop.
Intel C/C++ 12.0.4 generates wrong code and the assertion fails. Intel C/C++ 11 generates correct code.
#include <stdio.h>
#include <assert.h>
int c[4+3][3*2];
void f(int * const n, int * const m, int (**v)[*m * 2])
{
assert(&(c[*n][*m]) == &((*v)[*n][*m]));
}
int main(int argc, char* argv[])
{
int n = 4;
int m = 3;
int (*d)[3*2] = c;
f(&n, &m, &d);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment