[MDEV-31727] pcre stack frame size check failed on clang 16.0.6 Created: 2023-07-18  Updated: 2023-07-31  Resolved: 2023-07-21

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.4.30
Fix Version/s: 10.4.31, 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1

Type: Bug Priority: Major
Reporter: Z. Liu Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-13412 main.func_regexp_pcre fails in buildb... Closed

 Description   

as reported in https://bugs.gentoo.org/910188
for clang v16.0.6, pcretest -m -C will report stack frame size 32 < 256, then cmake/pcre.cmake will fail, earlier version (test by clang 15.0.7) is ok.



 Comments   
Comment by Daniel Black [ 2023-07-18 ]

Thanks for the bug report.

Changed bundled pcre to use noopt instead of noinline.

https://github.com/MariaDB/server/pull/2700/files

Also tried without success

@@ -676,7 +676,7 @@ if (ecode == NULL)
   else
     {
     int len = (int)((char *)&rdepth - (char *)eptr);
-    return (len > 0)? -len : len;
+    return [[clang::optnone]] (len > 0)? -len : len;
     }
   }
 #endif     /* NO_RECURSE */
@@ -6408,7 +6408,7 @@ result still unsigned". Hopefully the cast fixes that. */
 if (re == NULL && extra_data == NULL && subject == NULL && length == -999 &&
     start_offset == -999)
 #ifdef NO_RECURSE
-  return -((int)sizeof(heapframe));
+  return [[clang::optnone]] -((int)sizeof(heapframe));
 #else
   return match(NULL, NULL, NULL, 0, NULL, NULL, 0);
 #endif

Comment by Daniel Black [ 2023-07-21 ]

Thanks for the bug report.

Sorry that its a pcre one to fix and might just end up being a distro carried patch.

Thanks for letting us know so at least we can fall back to a bundled fixed version.

Comment by Daniel Black [ 2023-07-27 ]

liuzx did you have mtr troubles on tests: Failing test(s): main.execution_constants main.sp_notembedded main.sp-error ? There might be other aspects of stack length calculation that need to be fixed for clang

Comment by Z. Liu [ 2023-07-31 ]

I did a test and no error or warning found.

  1. ./mysql-test/mtr main.execution_constants
    Logging: /var/tmp/portage/dev-db/mariadb-10.4.30/work/mysql/mysql-test/mysql-test-run.pl main.execution_constants
    VS config:
    vardir: /var/tmp/portage/dev-db/mariadb-10.4.30/work/mysql_build/mysql-test/var
    Checking leftover processes...
    Removing old var directory...
    Creating var directory '/var/tmp/portage/dev-db/mariadb-10.4.30/work/mysql_build/mysql-test/var'...
    Checking supported features...
    MariaDB Version 10.4.30-MariaDB
  • SSL connections supported
  • binaries built with wsrep patch
    Collecting tests...
    Installing system database...

==============================================================================

TEST RESULT TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
worker[1] mysql-test-run: WARNING: running this script as root will cause some tests to be skipped
main.execution_constants [ pass ] 197
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.197 of 4 seconds executing testcases

Completed: All 1 tests were successful.

Comment by Daniel Black [ 2023-07-31 ]

thanks for confirming.

Obviously you're welcome to take my updated pcre patch to Gentoo in any form you choose.

Generated at Thu Feb 08 10:26:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.