[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] How serious is GCC "cast increases requiered alignment of target type" warning?
Am Mittwoch, den 26.05.2010, 13:56 +0200 schrieb Vincent Rivière
<vincent.riviere@freesbee.fr>:
> m0n0 wrote:
>> But I'm afraid about this: Is gcc smart enough to really increase the
>> alignment???
>
> We will be able to answer that question when we are able to reproduce
> the problem. A simple and self-contained testcase would be the best.
This is my testcase:
#include <stdio.h>
#include <math.h>
#include <stdint.h>
struct nsfb_s {
int width; /**< Visible width. */
int height; /**< Visible height. */
int bpp; /**< Bits per pixel. */
int refresh; /**< Desired refresh rate for physical displays. */
char *output_dev; /**> Path to output device for frontends that
require it. */
uint8_t *ptr; /**< Base of video memory. */
int linelen; /**< length of a video line. */
uint32_t palette[256]; /**< palette for index modes */
void *cursor; /**< cursor */
void *frontend_priv; /**< frontend opaque data. */
};
typedef struct nsfb_s nsfb_t;
static inline uint32_t *
get_xy_loc(nsfb_t *nsfb, int x, int y)
{
return (uint32_t *)(nsfb->ptr + (y * nsfb->linelen) + (x << 2));
}
int main()
{
nsfb_t foo;
get_xy_loc( &foo, 10,10);
return( 0 );
}
Compile:
m68k-atari-mint-gcc -c testm.c -Wall -Wcast-align