audacious-media-player / audacious

A lightweight and versatile audio player
https://audacious-media-player.org
Other
786 stars 105 forks source link

Build warning #1343

Closed Audacious-Bot closed 1 month ago

Audacious-Bot commented 1 month ago

Author Name: Artem S. Tashkinov Original Redmine Issue: https://redmine.audacious-media-player.org/issues/1203 Original Date: 2023-02-12


Leaving directory aosd.
In function ‘__copy_m’,
    inlined from ‘__copy_move_a2’ at /usr/include/c++/12/bits/stl_algobase.h:495:30,
    inlined from ‘__copy_move_a1’ at /usr/include/c++/12/bits/stl_algobase.h:522:42,
    inlined from ‘__copy_move_a’ at /usr/include/c++/12/bits/stl_algobase.h:529:31,
    inlined from ‘copy’ at /usr/include/c++/12/bits/stl_algobase.h:620:7,
    inlined from ‘__uninit_copy’ at /usr/include/c++/12/bits/stl_uninitialized.h:147:27,
    inlined from ‘uninitialized_copy’ at /usr/include/c++/12/bits/stl_uninitialized.h:185:15,
    inlined from ‘__uninitialized_copy_a’ at /usr/include/c++/12/bits/stl_uninitialized.h:372:37,
    inlined from ‘__uninitialized_move_if_noexcept_a’ at /usr/include/c++/12/bits/stl_uninitialized.h:397:2,
    inlined from ‘_M_fill_insert’ at /usr/include/c++/12/bits/vector.tcc:594:7,
    inlined from ‘resize’ at /usr/include/c++/12/bits/stl_vector.h:1032:18,
    inlined from ‘mc_alloc’ at desmume/mc.cc:90:17,
    inlined from ‘MMU_Init’ at desmume/MMU.cc:731:10,
    inlined from ‘NDS_Init’ at desmume/NDSSystem.cc:43:10,
    inlined from ‘play’ at plugin.cc:334:17:
/usr/include/c++/12/bits/stl_algobase.h:431:30: warning: ‘__builtin_memcpy’ writing 1 or more bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  431 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |                              ^
In member function ‘allocate’,
    inlined from ‘allocate’ at /usr/include/c++/12/bits/alloc_traits.h:464:28,
    inlined from ‘_M_allocate’ at /usr/include/c++/12/bits/stl_vector.h:378:33,
    inlined from ‘_M_fill_insert’ at /usr/include/c++/12/bits/vector.tcc:575:45,
    inlined from ‘resize’ at /usr/include/c++/12/bits/stl_vector.h:1032:18,
    inlined from ‘mc_alloc’ at desmume/mc.cc:90:17,
    inlined from ‘MMU_Init’ at desmume/MMU.cc:731:10,
    inlined from ‘NDS_Init’ at desmume/NDSSystem.cc:43:10,
    inlined from ‘play’ at plugin.cc:334:17:
/usr/include/c++/12/bits/new_allocator.h:137:55: note: at offset 262144 into destination object of size 262144 allocated by ‘operator new’
  137 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
      |  
Successfully linked console.so.
Leaving directory console.

No idea where it happens. Could it be console?

Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: Artem S. Tashkinov Original Date: 2023-02-12T16:39:06Z


This is when compiling/building audacious-plugins-4.3-beta1.tar.bz2

Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: Thomas Lange Original Date: 2023-02-13T23:55:58Z


Compile with -j1 or search for the "desmume/*.cc" folder/file. You will see this warning is from linking xsf. --> https://github.com/audacious-media-player/audacious-plugins/pull/106#issuecomment-1133286466

Which compiler and build system do you use? Does the workaround work for you too?

Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: Artem S. Tashkinov Original Date: 2023-02-21T07:48:20Z


Thomas Lange wrote:

Compile with -j1 or search for the "desmume/*.cc" folder/file. You will see this warning is from linking xsf. --> https://github.com/audacious-media-player/audacious-plugins/pull/106#issuecomment-1133286466

Which compiler and build system do you use? Does the workaround work for you too?

I use Fedora 37.

gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)

export CFLAGS="-O2 -mtune=generic -pipe -flto=auto"
export CXXFLAGS="$CFLAGS"

The issue is here:

Successfully compiled desmume/slot1_retail.cc (plugin).
(the same errors)
Successfully linked xsf.so.
Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: Artem S. Tashkinov Original Date: 2023-02-21T07:50:34Z


The linked patch fixes the issue.

diff --git a/src/xsf/desmume/mc.cc b/src/xsf/desmume/mc.cc
index dd6e670b1..648a5c89e 100644
--- a/src/xsf/desmume/mc.cc
+++ b/src/xsf/desmume/mc.cc
@@ -87,7 +87,7 @@ void mc_init(memory_chip_t *mc, int type)
 uint8_t *mc_alloc(memory_chip_t *mc, uint32_t size)
 {
        mc->data.clear();
-       mc->data.resize(size, 0);
+       mc->data.resize(size);
        mc->size = size;
        mc->writeable_buffer = true;
</code>
Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: John Lindgren Original Date: 2023-02-21T17:27:17Z


This seems to be the same as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366 which will supposedly be fixed in GCC 12.3.

Audacious-Bot commented 1 month ago

Original Redmine Comment Author Name: John Lindgren Original Date: 2023-02-21T18:05:53Z


Closing, as it's a compiler bug. The warning is a false-positive and harmless.