Re: [AD] Fixing a pair of trivial warnings in Allegro 4.4 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
The aliasing bug is upstream, in linux/soundcard.h
src/unix/uossmidi.c: In function 'oss_midi_key_on':
src/unix/uossmidi.c:529:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
SEQ_SET_PATCH(seq_device, hwvoice, inst);
^
src/unix/uossmidi.c:533:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
SEQ_CONTROL(seq_device, hwvoice, CTL_PAN, pan);
^
src/unix/uossmidi.c:534:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
SEQ_BENDER(seq_device, hwvoice, 8192 + bend);
^
src/unix/uossmidi.c: In function 'oss_midi_set_volume':
src/unix/uossmidi.c:562:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
SEQ_CONTROL(seq_device, voice, CTL_MAIN_VOLUME, vol);
^
src/unix/uossmidi.c: In function 'oss_midi_set_pitch':
src/unix/uossmidi.c:572:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
SEQ_CONTROL(seq_device, voice, CTRL_PITCH_BENDER, 8192 + bend);
^
#define SEQ_CONTROL(dev, chn, controller, value) \
_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
#define SEQ_BENDER(dev, chn, value) \
_CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
{_SEQ_NEEDBUF(8);\
_seqbuf[_seqbufptr] = EV_CHN_COMMON;\
_seqbuf[_seqbufptr+1] = (dev);\
_seqbuf[_seqbufptr+2] = (event);\
_seqbuf[_seqbufptr+3] = (chn);\
_seqbuf[_seqbufptr+4] = (p1);\
_seqbuf[_seqbufptr+5] = (p2);\
*(short *)&_seqbuf[_seqbufptr+6] = (w14);\
_SEQ_ADVBUF(8);}
*(short *)&_seqbuf[_seqbufptr+6] is an aliasing rule violation, AFAIU.
What course of action do you suggest?
Regards.
On 02/09/2015 03:15, SiegeLord wrote:
> Thanks, applied. The best way to send patches these days is through github.
>
> I'd prefer to fix the aliasing bugs, rather than disabling the aliasing
> optimizations, but if that's not possible, it'd be ok by me to add that
> flag.
>
> -SL
>
> On 09/01/2015 01:46 PM, Boon947 wrote:
>> Hello,
>>
>> I've posted this patch to the forums, but the discussion seems
>> to have died down. Is the mailing list a better place to discuss
>> patches?
>>
>> The attached patch fixes a pair of trivial warnings in Allegro 4.4
>>
>> I also noticed a warning about an aliasing problem in the OSS code;
>> with compilers becoming more aggressive at high optimization levels,
>> it might be prudent to add -fno-strict-aliasing to the CFLAGS, as
>> Linux has been doing for ages.
>>
>> Regards.