diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-02-14 15:15:10 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-05-02 21:36:45 +0200 |
commit | a17efd79d34285a695bf2044f65acf6b7637f98a (patch) | |
tree | 17e122f46bb46b0172d2e1e2343880de6a5d0e5c /flam3.c | |
parent | bae3078a59ffa404371f2095885bcf06984efad2 (diff) | |
download | pucket-a17efd79d34285a695bf2044f65acf6b7637f98a.tar.gz pucket-a17efd79d34285a695bf2044f65acf6b7637f98a.tar.bz2 pucket-a17efd79d34285a695bf2044f65acf6b7637f98a.zip |
Correctly align malloc’d vector arrays
Fixes segfault with -march=native
Diffstat (limited to 'flam3.c')
-rw-r--r-- | flam3.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -35,6 +35,7 @@ #include <unistd.h> #endif #include <errno.h> +#include <assert.h> #include <pthread.h> @@ -3259,7 +3260,8 @@ int flam3_estimate_bounding_box(flam3_genome *cp, double eps, int nsamples, if (nsamples <= 0) nsamples = 10000; - points = (double4 *) malloc(sizeof(double4) * nsamples); + int ret = posix_memalign ((void **) &points, sizeof (*points), sizeof(*points) * nsamples); + assert (ret == 0 && points != NULL); const double4 start = (double4) { rand_d11(rc), rand_d11(rc), 0.0, 0.0 }; if (prepare_precalc_flags(cp)) |