Bug 15073 - Fix building Samba with gcc 12
Summary: Fix building Samba with gcc 12
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.16.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-23 11:37 UTC by Andreas Schneider
Modified: 2022-06-14 00:43 UTC (History)
2 users (show)

See Also:


Attachments
patch for 4.16 (1.32 KB, patch)
2022-05-23 11:39 UTC, Andreas Schneider
asn: review? (metze)
Details
patch for 4.15 (1.32 KB, patch)
2022-05-23 11:42 UTC, Andreas Schneider
asn: review? (metze)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2022-05-23 11:37:27 UTC
Patch will follow ...
Comment 1 Andreas Schneider 2022-05-23 11:39:08 UTC
Created attachment 17296 [details]
patch for 4.16
Comment 2 Andreas Schneider 2022-05-23 11:42:49 UTC
Created attachment 17298 [details]
patch for 4.15
Comment 3 Stefan Metzmacher 2022-05-23 12:14:27 UTC
Comment on attachment 17296 [details]
patch for 4.16

Shouldn't we fix the code?
Comment 4 Andreas Schneider 2022-05-23 13:27:01 UTC
The code is correct, it has

if (count >= 1) {
    max_n[count]

    ...
}

Just gcc is not able to detect this. If you want to fix it you need to fully rewrite the code.
Comment 5 Andreas Schneider 2022-05-23 13:27:36 UTC
I've talked to gcc people, they suggested just this solution.
Comment 6 Volker Lendecke 2022-05-23 15:00:54 UTC
Moreover, this is the one in lib/util. source3/lib/util has its own flavor that does SMB_MALLOC....
Comment 7 Andreas Schneider 2022-05-24 08:08:50 UTC
The bug didn't go away when I talloc'ed max_n.