ANDREW, Perhaps I duplicated this incorrectly, but when I add after the line CFLAGS += $(static_incs) the lineCFLAGS += -Wall -fsanitize=alignment in guicast/Makefile to demonstrate the problem, I just get compiler errors. I also set the environment variable LDFLAGS and when I do echo $LDFLAGS it shows -fsanitize=alignment .
Did I make a mistake? Did I miss a step? The only steps I read in your email was:(1) modify guicast/Makefile to add another CFLAGS line
(2) set environment variable for LDFLAGS (before LDFLAGS had no value)See below for the end of my log file./usr/bin/ld: /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o): in function `BC_ListBoxItem::compare_item_text(void const*, void const*)':
/tmp/cinelerra-5.1/guicast/bclistboxitem.C:162: undefined reference to `__ubsan_handle_type_mismatch_v1'
/usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:163: undefined reference to `__ubsan_handle_type_mismatch_v1'
/usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:163: undefined reference to `__ubsan_handle_type_mismatch_v1'
/usr/bin/ld: /tmp/cinelerra-5.1/guicast/bclistboxitem.C:162: undefined reference to `__ubsan_handle_type_mismatch_v1'
/usr/bin/ld: /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o): in function `ArrayList<BC_ListBoxItem*>::del(BC_ListBoxItem*&)':/tmp/cinelerra-5.1/guicast/arraylist.h:14: undefined reference to `__ubsan_handle_type_mismatch_v1'
/usr/bin/ld: /tmp/cinelerra-5.1/cinelerra/../guicast/x86_64/libguicast.a(bclistboxitem.o):/tmp/cinelerra-5.1/guicast/arraylist.h:14: more undefined references to `__ubsan_handle_type_mismatch_v1' follow
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:607: x86_64/lv2ui] Error 1make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/cinelerra-5.1/cinelerra'
make[1]: *** [Makefile:582: all-recursive] Error 1
make[1]: Leaving directory '/tmp/cinelerra-5.1'make: *** [Makefile:529: all] Error 2On Wed, Nov 23, 2022 at 11:37 PM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:---------- Forwarded message ---------
От: Андрей Рандрианасулу <randrik@mail.ru>
Date: чт, 24 нояб. 2022 г., 09:33
Subject: unaligned load in bctheme
To: randrianasulu <randrianasulu@gmail.com>
so i tried to instrument cingg to see if she does any unaligned accessI addeddiff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefileindex 04d5a2e5..b724c668 100644--- a/cinelerra-5.1/guicast/Makefile+++ b/cinelerra-5.1/guicast/Makefile@@ -116,6 +116,7 @@ UTILS = $(OBJDIR)/bootstrap $(OBJDIR)/pngtoh $(OBJDIR)/pngtorawBCXFER = xfer/$(OBJDIR)/xfer.stampCFLAGS += $(static_incs)+CFLAGS += -Wall -fsanitize=alignment$(shell echo $(CFLAGS) > $(OBJDIR)/c_flags)$(shell echo $(OBJS) > $(OBJDIR)/objs)and same -fsanitize=alignment to LDFLAGS env. variable before make.I got this:bash-5.1$ /dev/shm/cinelerra/cinelerra-5.1/bin/cinCinelerra Infinity - built: Nov 24 2022 08:52:45(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguyCinelerra is free software, covered by the GNU General Public License,and you are welcome to change it and/or distribute copies of it undercertain conditions. There is absolutely no warranty for Cinelerra.build plugin index for: /dev/shm/cinelerra/cinelerra-5.1/bin/pluginsPluginFFilter::new_ffilter(overlay_opencl)err: Input/output errorPluginFFilter::new_ffilter(xfade_opencl)err: Input/output error[openclsrc_814 @ 0xb78f400] OpenCL source requires output dimensions to be specified.PluginFFilter::new_ffilter(openclsrc)err: Invalid argumentbctheme.C:458:15: runtime error: load of misaligned address 0x098a364d for type 'int', which requires 4 byte alignment0x098a364d: note: pointer points here45 47 27 00 48 21 00 00 31 30 38 30 74 6f 34 38 30 2e 70 6e 67 00 00 00 00 00 31 30 38 30 74 6f^Total excess of backups: -50Session time: 0:00:07Cpu time: user: 0:00:03.699 sys: 0:00:00.480so patch below fixes this error.Can you please test it on various arches and distros?diff --git a/cinelerra-5.1/guicast/bctheme.C b/cinelerra-5.1/guicast/bctheme.Cindex 1ec64c7f..9addf9f7 100644--- a/cinelerra-5.1/guicast/bctheme.C+++ b/cinelerra-5.1/guicast/bctheme.C@@ -455,7 +455,10 @@ void BC_Theme::overlay(VFrame *dst, VFrame *src, int in_x1, int in_x2, int shiftvoid BC_Theme::set_data(unsigned char *ptr){- int hdr_sz = *(int*)ptr - sizeof(int);+ //int hdr_sz = *(int*)ptr - sizeof(int);+ int hdr_sz = 0;+ memcpy(&hdr_sz, ptr, sizeof(int));+ hdr_sz -= sizeof(int);unsigned char *cp = ptr + sizeof(int);unsigned char *dp = cp + hdr_sz;int start_item = images.size();lines 7-28/28 (END)--
Андрей Рандрианасулу