From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id F028A385135B for ; Sat, 10 Dec 2022 17:41:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F028A385135B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62e.google.com with SMTP id 4so2075226plj.3 for ; Sat, 10 Dec 2022 09:41:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=I/9sSWu8A3B2QfmCVE5EDr4xfO8wFSafAyvZU685xZs=; b=J0IkJArjQqloqu0rdCParuudE3p3nrBMZVcIW1wkmc4mL1FGGnSFi2hvZ4/yUY9Cxp g6d3VvLvVShKZTKxikm5IOHQJUvloY00fzwt/i6w8ugMqxfw17qZA55pjamPOlfVtuuK 8VfbT+cEl4V5YkJ7bq/R0ZrQOTmXK7lP3Eo/Che5Q15xPMK0LrnegcmOovUqe8NYDSCE kd8Uxtpmg5BallNjNezrd6LPmXwTmhOVw63Ab4E4nIXqwWBKYIh/GOu2BnKyNcWxLRhW n9ysjeuLCL2CJdOG/gC4347xrcfpdKW3UD248GBb8knfFq95CnI2FG+r6zWnzKaiyxUy 4smg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=I/9sSWu8A3B2QfmCVE5EDr4xfO8wFSafAyvZU685xZs=; b=LzxgLNTjHEo9pjyig6fNdy6qOrBiyUUxujTF5obQjrudle7RyN+9az1b3QvkvBo8Cg jAvFhWxlBA55+VXdGmUNLN5WBkuGVnBBFRwkoe0fkrAR4DGQ5VeJNr2G8Tt16/9HOXqq gpEbezByBGq+ua8ZpOFnc44pypSPTgE+tD6wpdfua4ItTmCOjXGS19tICEAyZourAj0p l0aJOaGfffQ8HganFcLWC4bcPcy0TUmqYWMHXhJmrGEG1penyVyqIttK6rGbAIm4iSJk 4xBeg9R1gfil9aNX2Zbt0HPjkZXVUwEZBGVexnJfpiDVoDI+W4rgHIoWfF5JAsTsscqw 29Jw== X-Gm-Message-State: ANoB5pkjKo5lSNWPyOU1VSiYOaKr8oXoy2keEW5sXvx/lW7poCW8CiQJ vxiYMUOHCzg6+R5P+YcnXeUgKHdyGiMLuOQ2bPuLl7P+3G4= X-Google-Smtp-Source: AA0mqf7CxTUZhIUbc8IfnS2x+qevOntO3aGOlvmjJyFf2ADc9YbVi0p+wfOc7zZ4ZF7QJb6M72CYZq99n+E070NwIrQ= X-Received: by 2002:a17:902:e807:b0:189:117c:fcfe with SMTP id u7-20020a170902e80700b00189117cfcfemr79341658plg.124.1670694083538; Sat, 10 Dec 2022 09:41:23 -0800 (PST) MIME-Version: 1.0 From: Gavin Ray Date: Sat, 10 Dec 2022 12:41:13 -0500 Message-ID: Subject: Bug with GCC's handling of lifetimes of implicit-lifetime types To: gcc@gcc.gnu.org Content-Type: multipart/alternative; boundary="00000000000060b57705ef7cc7f2" X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000060b57705ef7cc7f2 Content-Type: text/plain; charset="UTF-8" This came up when I was asking around about what the proper way was to: - Allocate aligned storage for a buffer pool/page cache - Then create pointers to "Page" structs inside of the storage memory area I thought something like this might do: struct buffer_pool { alignas(PAGE_SIZE) std::byte storage[NUM_PAGES * PAGE_SIZE]; page* pages = new (storage) page[NUM_PAGES]; } Someone told me that this was a valid solution but not to do it, because it wouldn't function properly on GCC They gave this as a reproduction: https://godbolt.org/z/EhzM37Gzh I'm not experienced enough with C++ to grok the connection between this repro and my code, but I figured I'd post it on the mailing list in case it was useful for others/might get fixed in the future =) They said it had to do with "handling of lifetimes of implicit-lifetime types" --00000000000060b57705ef7cc7f2--