Last active
August 29, 2015 14:10
-
-
Save mkrautz/ef6ea55f41e092a9f4b3 to your computer and use it in GitHub Desktop.
MSVC 2013 crasher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build with "cl -O2 /fp:fast crash.c" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define IMIN(a,b) (float)(a>b?a:b) | |
struct TonalityAnalysis { | |
int count; | |
float std[4]; | |
}; | |
int main() { | |
int i; | |
struct TonalityAnalysis *tonal = malloc(sizeof(struct TonalityAnalysis)); | |
tonal->count = 6; | |
for (i=0;i<4;i++) | |
tonal->std[i]=(float)i; | |
printf("tonal = %p\n", tonal); | |
printf("tonal->std = %p\n", &tonal->std[0]); | |
float alpha = 1.f/IMIN(20, 1+tonal->count); | |
float features[4]; | |
for (i=0;i<4;i++) | |
features[i]=(float)i; | |
if (tonal->count > 6) { | |
for (i=0;i<4;i++) | |
tonal->std[i] = (1-alpha)*tonal->std[i] + alpha*features[i]*features[i]; | |
} | |
for (i=0;i<4;i++) | |
features[i] = (float)sqrt(tonal->std[i]); | |
for (i=0;i<4;i++) | |
printf("%.2f\n", features[i]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment