Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #147715 > unrolled thread

mergesort code segfaulting on smallish arrays

Started byDFS <nospam@dfs.com>
First post2019-11-07 10:39 -0500
Last post2019-11-11 00:56 +0000
Articles 20 on this page of 220 — 19 participants

Back to article view | Back to comp.lang.c


Contents

  mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 10:39 -0500
    Re: mergesort code segfaulting on smallish arrays Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-07 07:48 -0800
      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-07 16:02 +0000
      Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 11:34 -0500
        Re: mergesort code segfaulting on smallish arrays Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-07 08:41 -0800
          Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 13:02 -0500
            Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-07 10:37 -0800
              Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 14:38 -0500
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 16:44 +0100
                  Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 13:01 -0500
                    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 10:39 +0100
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 10:52 +0100
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 11:12 +0100
            Re: mergesort code segfaulting on smallish arrays Barry Schwarz <schwarzb@delq.com> - 2019-11-07 12:28 -0800
            Re: mergesort code segfaulting on smallish arrays jadill33@gmail.com - 2019-11-07 13:13 -0800
              Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-08 00:55 +0000
                Re: mergesort code segfaulting on smallish arrays jadill33@gmail.com - 2019-11-08 05:30 -0800
          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 14:50 +0100
            Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 09:31 -0500
              Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 09:39 -0500
            Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-08 17:53 +0000
              Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 13:15 -0500
                Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-08 20:01 +0000
                  Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 00:24 +0000
                    Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 09:44 -0500
                      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 15:45 +0000
                        Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 14:30 -0500
                    Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 12:41 -0500
                      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 19:29 +0000
                        Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 14:59 -0500
                          Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 22:00 +0000
                            Re: mergesort code segfaulting on smallish arrays Ian Collins <ian-news@hotmail.com> - 2019-11-10 11:24 +1300
                              Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 22:48 +0000
                                Re: mergesort code segfaulting on smallish arrays Ian Collins <ian-news@hotmail.com> - 2019-11-10 12:09 +1300
                                Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 14:46 +0100
                                  Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 14:11 +0000
                                    Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 17:27 +0100
                              Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-09 14:53 -0800
                                Re: mergesort code segfaulting on smallish arrays Ian Collins <ian-news@hotmail.com> - 2019-11-10 12:02 +1300
              Re: mergesort code segfaulting on smallish arrays Ian Collins <ian-news@hotmail.com> - 2019-11-09 09:25 +1300
              Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-09 20:18 +0000
                Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 21:55 -0500
                  Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-10 09:49 +0000
        Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-07 10:34 -0800
    Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-07 16:12 +0000
      Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 12:19 -0500
        Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-07 17:42 +0000
          Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-07 13:32 -0500
      Re: mergesort code segfaulting on smallish arrays Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-11-07 11:15 -0700
        Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-07 21:57 +0000
          Re: mergesort code segfaulting on smallish arrays Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-11-07 19:11 -0700
        Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-07 21:57 +0000
    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 09:21 +0100
      Re: mergesort code segfaulting on smallish arrays chad <cdalten@gmail.com> - 2019-11-08 04:10 -0800
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 13:21 +0100
          Re: mergesort code segfaulting on smallish arrays chad <cdalten@gmail.com> - 2019-11-13 04:12 -0800
            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 13:55 +0100
        Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 09:20 -0500
      Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 10:23 -0500
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 16:36 +0100
          Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 11:56 -0500
            Re: mergesort code segfaulting on smallish arrays Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-08 09:42 -0800
              Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 13:39 -0500
      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 17:14 +0100
        Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 12:00 -0500
          Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-14 13:27 -0800
            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-15 08:17 +0100
              Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-15 13:16 -0800
                Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-15 22:35 +0000
                  Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-16 13:34 -0800
                    Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-16 23:01 +0000
                      Re: mergesort code segfaulting on smallish arrays Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-11-17 08:34 +0000
                        Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-17 09:13 +0000
                          Re: mergesort code segfaulting on smallish arrays Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-11-17 09:30 +0000
                            Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-17 13:53 -0800
                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-17 10:27 +0100
                            Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-17 09:44 +0000
                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-17 10:50 +0100
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-16 07:26 +0100
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 18:07 +0100
          Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-08 12:40 -0500
            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 20:41 +0100
              Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-14 13:28 -0800
      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 06:14 +0100
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 08:03 +0100
        Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 02:20 -0500
          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 08:21 +0100
      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 08:30 +0100
        Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 12:50 -0500
          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 19:18 +0100
            Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-09 14:27 -0500
              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 07:46 +0100
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 09:32 +0100
                  Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-13 09:34 -0500
                    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 16:01 +0100
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 17:19 +0100
                      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-13 16:32 +0000
                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 17:50 +0100
                          Re: mergesort code segfaulting on smallish arrays chad <cdalten@gmail.com> - 2019-11-13 11:09 -0800
                          Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-13 19:18 +0000
                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 20:31 +0100
                      Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-13 17:12 -0800
                      Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-13 20:26 -0800
                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 06:16 +0100
                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 06:40 +0100
                          Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-14 01:11 -0500
                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 10:41 +0100
                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 06:42 +0100
                          Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-13 21:56 -0800
                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 10:42 +0100
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 06:39 +0100
                      Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-13 21:38 -0800
    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 14:33 +0100
      Re: mergesort code segfaulting on smallish arrays Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-08 05:44 -0800
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 14:48 +0100
          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 15:01 +0100
            Re: mergesort code segfaulting on smallish arrays Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-08 08:00 -0800
              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-08 17:12 +0100
              Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-08 16:34 +0000
                Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-12 17:05 +0000
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 18:07 +0100
      Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-08 23:50 +0000
        Re: mergesort code segfaulting on smallish arrays Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-08 19:55 -0800
          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 17:27 +0100
            Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-09 19:33 +0000
              Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-09 18:05 -0800
              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 05:58 +0100
                Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 12:39 +0000
                  Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 12:48 +0000
                  Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 14:38 +0100
                    Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-10 13:42 +0000
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 14:46 +0100
                        Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-10 14:04 +0000
                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:05 +0100
                            Re: mergesort code segfaulting on smallish arrays Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-10 14:09 +0000
                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:19 +0100
                    Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 14:06 +0000
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:22 +0100
                        Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 14:30 +0000
                          Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 14:36 +0000
                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:59 +0100
                              Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 15:26 +0000
                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:56 +0100
                            Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 15:21 +0000
                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 16:28 +0100
                                Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 15:38 +0000
                                  Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 16:58 +0100
                                    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 16:59 +0100
                                      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 16:24 +0000
                                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 17:37 +0100
                                          Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-10 17:22 +0000
                                            Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 18:04 +0000
                                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 19:10 +0100
                                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 19:14 +0100
                                                Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-11 02:14 +0000
                                                  Re: mergesort code segfaulting on smallish arrays DFS <nospam@dfs.com> - 2019-11-10 22:07 -0500
                                                    Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-11 22:16 +0000
                                                  Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-11 06:52 +0100
                                                    Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-11 10:33 -0800
                                                    Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-11 23:28 +0000
                                                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 10:56 +0100
                                                        Re: mergesort code segfaulting on smallish arrays "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-12 02:35 -0800
                                                        Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-12 15:01 +0000
                                                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 16:08 +0100
                                                            Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-12 15:53 +0000
                                                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 16:56 +0100
                                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-11 13:45 +0100
                                                Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 08:00 -0800
                                                  Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 17:03 +0100
                                                    Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 08:27 -0800
                                                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 17:29 +0100
                                                Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 08:18 -0800
                                                  Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 17:27 +0100
                                                    Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 08:43 -0800
                                                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 18:01 +0100
                                                        Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 09:41 -0800
                                                          Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 18:44 +0100
                                                            Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 11:00 -0800
                                                              Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 20:03 +0100
                                                                Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 11:22 -0800
                                                                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-12 20:24 +0100
                                                                  Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-12 11:44 -0800
                                                                    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 06:23 +0100
                                                                      Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-13 06:40 -0800
                                                                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 16:34 +0100
                                                                          Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-13 08:41 -0800
                                Re: mergesort code segfaulting on smallish arrays James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-11 11:24 -0800
            Re: mergesort code segfaulting on smallish arrays Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-10 05:13 -0800
          Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-09 19:36 +0000
            Re: mergesort code segfaulting on smallish arrays Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-10 05:27 -0800
        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 05:25 +0100
          Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 11:30 -0500
            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 17:49 +0100
              Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 12:21 -0500
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 18:53 +0100
                  Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 13:33 -0500
                    Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-09 19:37 +0100
                      Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-09 18:51 +0000
                        Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 14:46 -0500
                        Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 15:35 +0100
                          Re: mergesort code segfaulting on smallish arrays Bart <bc@freeuk.com> - 2019-11-10 14:48 +0000
                      Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 15:35 +0100
                        Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:39 +0100
                          Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 19:54 +0100
                            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 19:55 +0100
                              Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 21:34 +0100
                                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 21:37 +0100
                      Re: mergesort code segfaulting on smallish arrays Robert Wessel <robertwessel2@yahoo.com> - 2019-11-11 11:12 -0600
                    Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 15:28 +0100
                      Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 15:41 +0100
                Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-09 12:47 -0800
                Re: mergesort code segfaulting on smallish arrays David Brown <david.brown@hesbynett.no> - 2019-11-10 15:08 +0100
                  Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-10 14:30 -0800
            Re: mergesort code segfaulting on smallish arrays Keith Thompson <kst-u@mib.org> - 2019-11-09 12:43 -0800
              Re: mergesort code segfaulting on smallish arrays Richard Damon <Richard@Damon-Family.org> - 2019-11-09 17:16 -0500
          Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-09 19:27 +0000
            Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 05:55 +0100
              Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-10 16:45 +0000
                Re: mergesort code segfaulting on smallish arrays Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-10 17:53 +0100
                  Re: mergesort code segfaulting on smallish arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-11 00:56 +0000

Page 4 of 11 — ← Prev page 1 2 3 [4] 5 6 … 11  Next page →


#147783

FromDFS <nospam@dfs.com>
Date2019-11-08 11:56 -0500
Message-ID<m5hxF.19762$2A5.8745@fx38.iad>
In reply to#147775
On 11/8/2019 10:36 AM, Bonita Montero wrote:
>> And yours is slow compared to mine (for 1M elements anyway).
> 
> The difference in runtime comes from the the higher quality random
> -number-generator. 
> The sort-code should be equally fast at best.
> std::copy uses memmove internally, which might not be optimally
> because the copied tail of either subarray should be rather small
> and memmove has a setup-time, looking for overlapping, alignment
> to use xmm-instructions etc; a lot of things which aren't necessary.
> I just wanted to code it as convenient and readable as possible.
> 
> Here's the changed code of the recursion for which you should get
> at best an equal performance:
> 
> template<typename It, typename Cmp>
> template<typename UpIt, typename BufIt>
> void merge_sort<It, Cmp>::recursion( UpIt start, UpIt end, BufIt buf )
> {
>      using namespace std;
>      if( end - start <= 1 )
>          return;
>      copy( start, end, buf );
>      size_t n          = end - start;
>      BufIt  leftBuf    = buf,
>             leftBufEnd = buf + n / 2,
>             rightBuf   = leftBufEnd,
>             bufEnd     = buf + n;
>      recursion( leftBuf,  leftBufEnd, bufEnd );
>      recursion( rightBuf, bufEnd,     bufEnd );
>      for( UpIt wrtBack = start; ; )
>          if( m_cmp( *leftBuf, *rightBuf ) )
>          {
>              *wrtBack++ = *leftBuf;
>              if( ++leftBuf == leftBufEnd )
>              {
>                  do
>                      *wrtBack++ = *rightBuf;
>                  while( ++rightBuf != bufEnd );
>                  break;
>              }
>          }
>          else
>          {
>              *wrtBack++ = *rightBuf;
>              if( ++rightBuf == bufEnd )
>              {
>                  do
>                      *wrtBack++ = *leftBuf;
>                  while( ++leftBuf != leftBufEnd );
>                  break;
>              }
>          }
> }
> 
> Consider that my code has a large runtime because of the higher quality
> randomness and conditionally for the checking to be sorted at the end.


for( vector<int>::iterator scn = rv.begin(); scn < rv.end() - 1; ++scn )
           assert(scn[0] <= scn[1]);


That's good to have.  I've been meaning to put one in.

Edit: just did and it barely affected the time.

N=1,000,000
no sort check : 1.5001 1.5028 1.5012 1.5081
add sort check: 1.5076 1.5120 1.5093 1.5087

It still floors me how fast C does something like that: make 999,999 int 
comparisons in well under 1/100ths of a second (on my old CPU).


   //validate the sort
   //randoms[arrsize/3]=3;
   for(i=0;i<arrsize-1;i++) {
     if(randoms[i]>randoms[i+1]) {
       printf("Invalid sort:\n"
              "Item %d = %d\n"
              "Item %d = %d\n",
              i,  randoms[i],
              i+1,randoms[i+1]);
       exit(1);
     }
   }


I tested the sort check by setting various r[i] to low numbers.

Invalid sort:
Item 333332 = 1330939
Item 333333 = 3


> And the thing is that my code is much more flexible; it could be adapted
> to any data-types throug a template-parameter. 

How much work to update your C++ routine to mergesort an array of random 
strings of random length ?  10 minutes?  30 minutes?

It would be impractical to alter my C routine to accept ints, floats or 
chars.  Better to have 3 separate programs.


> structs should be ref'd
> via a pointer encapsulated in an object on which a comparison is defi-
> ned.

[toc] | [prev] | [next] | [standalone]


#147787

FromMalcolm McLean <malcolm.arthur.mclean@gmail.com>
Date2019-11-08 09:42 -0800
Message-ID<bca1a840-4c41-48c6-9004-154d1813cbae@googlegroups.com>
In reply to#147783
On Friday, 8 November 2019 16:54:53 UTC, DFS  wrote:
> On 11/8/2019 10:36 AM, Bonita Montero wrote:
>
> 
> > And the thing is that my code is much more flexible; it could be adapted
> > to any data-types throug a template-parameter. 
> 
> How much work to update your C++ routine to mergesort an array of random 
> strings of random length ?  10 minutes?  30 minutes?
> 
> It would be impractical to alter my C routine to accept ints, floats or 
> chars.  Better to have 3 separate programs.
> 
A production C sort is usually a bit of scratch code, because it is sorting
a short list of items where qsort() would be too slow or is unavailable.

But if you want a general-purpose sort routine, write it like qsort,
to take a void * as the array, the number of elements, the element size,
and a comparison function as a function pointer. Then you can sort
any C array with the same function.

It is more work to write and it will run a bit slower, largely because 
you've got to move individual items with a byte-copying loop - you're
not specifying an alignment though in reality your items will almost
always be 4-byte aligned.

[toc] | [prev] | [next] | [standalone]


#147792

FromDFS <nospam@dfs.com>
Date2019-11-08 13:39 -0500
Message-ID<DCixF.4746$II7.1080@fx17.iad>
In reply to#147787
On 11/8/2019 12:42 PM, Malcolm McLean wrote:
> On Friday, 8 November 2019 16:54:53 UTC, DFS  wrote:
>> On 11/8/2019 10:36 AM, Bonita Montero wrote:
>>
>>
>>> And the thing is that my code is much more flexible; it could be adapted
>>> to any data-types throug a template-parameter.
>>
>> How much work to update your C++ routine to mergesort an array of random
>> strings of random length ?  10 minutes?  30 minutes?
>>
>> It would be impractical to alter my C routine to accept ints, floats or
>> chars.  Better to have 3 separate programs.
>>
> A production C sort is usually a bit of scratch code, because it is sorting
> a short list of items where qsort() would be too slow or is unavailable.


The best scratch sort code is python:

sortedlist = sorted(list)
or
sortedlist = sorted(list,key=str.lower)


How would qsort be unavailable?



> But if you want a general-purpose sort routine, write it like qsort,
> to take a void * as the array, the number of elements, the element size,
> and a comparison function as a function pointer. Then you can sort
> any C array with the same function.

That's a good idea.

I've already written qsort routines and compare functions for ints and 
chars, so I might give this flexible sort procedure a try.



> It is more work to write and it will run a bit slower, largely because
> you've got to move individual items with a byte-copying loop - you're
> not specifying an alignment though in reality your items will almost
> always be 4-byte aligned.


[toc] | [prev] | [next] | [standalone]


#147781

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-08 17:14 +0100
Message-ID<qq449u$bs5$2@news.albasani.net>
In reply to#147760
So here's an exemplary solution in C which does the same thing as the
C++ solution. The drawback is that it is fixed to integer-sorting and
can't be adapted to other types:

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <assert.h>

int merge_sort( int *start, size_t n );

int main()
{
     size_t const N = 100000000;
     int *p = malloc( N * sizeof(int) );
     printf( "randomizing ...\n" );
     int *s = p;
     for( s = p; s != p + N; *s++ = rand() );
     printf( "sorting ...\n" );
     merge_sort( p, N );
     for( int *scn = p; scn < p + N - 1; ++scn )
         assert( scn[0] <= scn[1] );
     printf( "... sorted n" );
}

void ms_recursion( int *start, int *end, int *buf );

int merge_sort( int *start, size_t n )
{
     size_t bs = 0;
     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
     int *buf = malloc( bs * sizeof(int) );
     if( !buf )
         return 0;
     ms_recursion( start, start + n, buf );
     free( buf );
     return 1;
}

void ms_recursion( int *start, int *end, int *buf )
{
     if( end - start <= 1 )
         return;
     for( int *cpy = start; cpy != end; *buf++ = *cpy++ );
     size_t  n          = end - start;
     int    *leftBuf    = buf,
            *leftBufEnd = buf + n / 2,
            *rightBuf   = leftBufEnd,
            *bufEnd     = buf + n;
     ms_recursion( leftBuf,  leftBufEnd, bufEnd );
     ms_recursion( rightBuf, bufEnd,     bufEnd );
     for( int *wrtBack = start; ; )
         if( *leftBuf <= *rightBuf )
         {
             *wrtBack++ = *leftBuf;
             if( ++leftBuf == leftBufEnd )
             {
                 do
                     *wrtBack++ = *rightBuf;
                 while( ++rightBuf != bufEnd );
                 break;
             }
         }
         else
         {
             *wrtBack++ = *rightBuf;
             if( ++rightBuf == bufEnd )
             {
                 do
                     *wrtBack++ = *leftBuf;
                 while( ++leftBuf != leftBufEnd );
                 break;
             }
         }
}

[toc] | [prev] | [next] | [standalone]


#147784

FromDFS <nospam@dfs.com>
Date2019-11-08 12:00 -0500
Message-ID<89hxF.10278$MR5.2158@fx28.iad>
In reply to#147781
On 11/8/2019 11:14 AM, Bonita Montero wrote:
> So here's an exemplary solution in C which does the same thing as the
> C++ solution. The drawback is that it is fixed to integer-sorting and
> can't be adapted to other types:
> 
> #include <stdio.h>
> #include <stddef.h>
> #include <stdlib.h>
> #include <assert.h>
> 
> int merge_sort( int *start, size_t n );
> 
> int main()
> {
>      size_t const N = 100000000;
>      int *p = malloc( N * sizeof(int) );
>      printf( "randomizing ...\n" );
>      int *s = p;
>      for( s = p; s != p + N; *s++ = rand() );
>      printf( "sorting ...\n" );
>      merge_sort( p, N );
>      for( int *scn = p; scn < p + N - 1; ++scn )
>          assert( scn[0] <= scn[1] );
>      printf( "... sorted n" );
> }
> 
> void ms_recursion( int *start, int *end, int *buf );
> 
> int merge_sort( int *start, size_t n )
> {
>      size_t bs = 0;
>      for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );


$ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
Bonita_Montero_mergesort.c: In function ‘merge_sort’:
Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’ 
[-Wunused-variable]
    27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
       |                 ^~~~~




>      int *buf = malloc( bs * sizeof(int) );
>      if( !buf )
>          return 0;
>      ms_recursion( start, start + n, buf );
>      free( buf );
>      return 1;
> }
> 
> void ms_recursion( int *start, int *end, int *buf )
> {
>      if( end - start <= 1 )
>          return;
>      for( int *cpy = start; cpy != end; *buf++ = *cpy++ );
>      size_t  n          = end - start;
>      int    *leftBuf    = buf,
>             *leftBufEnd = buf + n / 2,
>             *rightBuf   = leftBufEnd,
>             *bufEnd     = buf + n;
>      ms_recursion( leftBuf,  leftBufEnd, bufEnd );
>      ms_recursion( rightBuf, bufEnd,     bufEnd );
>      for( int *wrtBack = start; ; )
>          if( *leftBuf <= *rightBuf )
>          {
>              *wrtBack++ = *leftBuf;
>              if( ++leftBuf == leftBufEnd )
>              {
>                  do
>                      *wrtBack++ = *rightBuf;
>                  while( ++rightBuf != bufEnd );
>                  break;
>              }
>          }
>          else
>          {
>              *wrtBack++ = *rightBuf;
>              if( ++rightBuf == bufEnd )
>              {
>                  do
>                      *wrtBack++ = *leftBuf;
>                  while( ++leftBuf != leftBufEnd );
>                  break;
>              }
>          }
> }

[toc] | [prev] | [next] | [standalone]


#148006

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2019-11-14 13:27 -0800
Message-ID<qqkgs4$175q$1@gioia.aioe.org>
In reply to#147784
On 11/8/2019 9:00 AM, DFS wrote:
> On 11/8/2019 11:14 AM, Bonita Montero wrote:
>> So here's an exemplary solution in C which does the same thing as the
>> C++ solution. The drawback is that it is fixed to integer-sorting and
>> can't be adapted to other types:
>>
>> #include <stdio.h>
>> #include <stddef.h>
>> #include <stdlib.h>
>> #include <assert.h>
>>
>> int merge_sort( int *start, size_t n );
>>
>> int main()
>> {
>>      size_t const N = 100000000;
>>      int *p = malloc( N * sizeof(int) );
>>      printf( "randomizing ...\n" );
>>      int *s = p;
>>      for( s = p; s != p + N; *s++ = rand() );
>>      printf( "sorting ...\n" );
>>      merge_sort( p, N );
>>      for( int *scn = p; scn < p + N - 1; ++scn )
>>          assert( scn[0] <= scn[1] );
>>      printf( "... sorted n" );
>> }
>>
>> void ms_recursion( int *start, int *end, int *buf );
>>
>> int merge_sort( int *start, size_t n )
>> {
>>      size_t bs = 0;
>>      for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
> 
> 
> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’ 
> [-Wunused-variable]
>     27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>        |                 ^~~~~
[...]

Unused variable in a loop? Humm...

[toc] | [prev] | [next] | [standalone]


#148018

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-15 08:17 +0100
Message-ID<qqljes$94n$1@news.albasani.net>
In reply to#148006
>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’ 
>> [-Wunused-variable]
>>     27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>        |                 ^~~~~
> [...]

> Unused variable in a loop? Humm...

The above bug led to a unecessarily large buffer-allocation.
I already fixed that.

[toc] | [prev] | [next] | [standalone]


#148036

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2019-11-15 13:16 -0800
Message-ID<qqn4iv$1bi3$1@gioia.aioe.org>
In reply to#148018
On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’ 
>>> [-Wunused-variable]
>>>     27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>        |                 ^~~~~
>> [...]
> 
>> Unused variable in a loop? Humm...
> 
> The above bug led to a unecessarily large buffer-allocation.
> I already fixed that.

Good! You should really be running your work through AddressSanitizer, 
ThreadSanitizer and Relacy to help check for these things. They help 
kick the shi% out of your code.

[toc] | [prev] | [next] | [standalone]


#148039

FromMelzzzzz <Melzzzzz@zzzzz.com>
Date2019-11-15 22:35 +0000
Message-ID<QKFzF.282138$WE5.206472@fx30.am4>
In reply to#148036
On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’ 
>>>> [-Wunused-variable]
>>>>     27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>>        |                 ^~~~~
>>> [...]
>> 
>>> Unused variable in a loop? Humm...
>> 
>> The above bug led to a unecessarily large buffer-allocation.
>> I already fixed that.
>
> Good! You should really be running your work through AddressSanitizer, 
> ThreadSanitizer and Relacy to help check for these things. They help 
> kick the shi% out of your code.
What code?

-- 
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi 
bili naoruzani. -- Mladen Gogala

[toc] | [prev] | [next] | [standalone]


#148050

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2019-11-16 13:34 -0800
Message-ID<qqpq1h$15qf$1@gioia.aioe.org>
In reply to#148039
On 11/15/2019 2:35 PM, Melzzzzz wrote:
> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>> On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’
>>>>> [-Wunused-variable]
>>>>>      27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>>>         |                 ^~~~~
>>>> [...]
>>>
>>>> Unused variable in a loop? Humm...
>>>
>>> The above bug led to a unecessarily large buffer-allocation.
>>> I already fixed that.
>>
>> Good! You should really be running your work through AddressSanitizer,
>> ThreadSanitizer and Relacy to help check for these things. They help
>> kick the shi% out of your code.
> What code?
> 

Interesting question! Humm... Still, these tools are pretty nice.

[toc] | [prev] | [next] | [standalone]


#148051

FromMelzzzzz <Melzzzzz@zzzzz.com>
Date2019-11-16 23:01 +0000
Message-ID<fd%zF.487845$NI41.360441@fx12.am4>
In reply to#148050
On 2019-11-16, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> On 11/15/2019 2:35 PM, Melzzzzz wrote:
>> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>> On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>>>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>>>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>>>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’
>>>>>> [-Wunused-variable]
>>>>>>      27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>>>>         |                 ^~~~~
>>>>> [...]
>>>>
>>>>> Unused variable in a loop? Humm...
>>>>
>>>> The above bug led to a unecessarily large buffer-allocation.
>>>> I already fixed that.
>>>
>>> Good! You should really be running your work through AddressSanitizer,
>>> ThreadSanitizer and Relacy to help check for these things. They help
>>> kick the shi% out of your code.
>> What code?
>> 
>
> Interesting question! Humm... Still, these tools are pretty nice.

I stick to as much as possible simple code. Too old...


-- 
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi 
bili naoruzani. -- Mladen Gogala

[toc] | [prev] | [next] | [standalone]


#148052

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2019-11-17 08:34 +0000
Message-ID<slrnqt21g3.2ntj.grahn+nntp@frailea.sa.invalid>
In reply to#148051
On Sat, 2019-11-16, Melzzzzz wrote:
> On 2019-11-16, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>> On 11/15/2019 2:35 PM, Melzzzzz wrote:
>>> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>>> On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>>>>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>>>>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>>>>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’
>>>>>>> [-Wunused-variable]
>>>>>>>      27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>>>>>         |                 ^~~~~
>>>>>> [...]
>>>>>
>>>>>> Unused variable in a loop? Humm...
>>>>>
>>>>> The above bug led to a unecessarily large buffer-allocation.
>>>>> I already fixed that.
>>>>
>>>> Good! You should really be running your work through AddressSanitizer,
>>>> ThreadSanitizer and Relacy to help check for these things. They help
>>>> kick the shi% out of your code.
>>> What code?
>>> 
>>
>> Interesting question! Humm... Still, these tools are pretty nice.
>
> I stick to as much as possible simple code. Too old...

Running the sanitizers is just a matter of recompiling with something
like -fsanitize=address,leak,undefined, running your program and
seeing if it crashes. (With a semi-recent gcc or clang.)

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#148053

FromMelzzzzz <Melzzzzz@zzzzz.com>
Date2019-11-17 09:13 +0000
Message-ID<ya8AF.245960$Yl3.90191@fx24.am4>
In reply to#148052
On 2019-11-17, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
> On Sat, 2019-11-16, Melzzzzz wrote:
>> On 2019-11-16, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>> On 11/15/2019 2:35 PM, Melzzzzz wrote:
>>>> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>>>> On 11/14/2019 11:17 PM, Bonita Montero wrote:
>>>>>>>> $ gcc -Wall -o bm.exe Bonita_Montero_mergesort.c
>>>>>>>> Bonita_Montero_mergesort.c: In function ‘merge_sort’:
>>>>>>>> Bonita_Montero_mergesort.c:27:17: warning: unused variable ‘nHalf’
>>>>>>>> [-Wunused-variable]
>>>>>>>>      27 |     for( size_t nHalf = n; n > 1; bs += n, n -= n / 2 );
>>>>>>>>         |                 ^~~~~
>>>>>>> [...]
>>>>>>
>>>>>>> Unused variable in a loop? Humm...
>>>>>>
>>>>>> The above bug led to a unecessarily large buffer-allocation.
>>>>>> I already fixed that.
>>>>>
>>>>> Good! You should really be running your work through AddressSanitizer,
>>>>> ThreadSanitizer and Relacy to help check for these things. They help
>>>>> kick the shi% out of your code.
>>>> What code?
>>>> 
>>>
>>> Interesting question! Humm... Still, these tools are pretty nice.
>>
>> I stick to as much as possible simple code. Too old...
>
> Running the sanitizers is just a matter of recompiling with something
> like -fsanitize=address,leak,undefined, running your program and
> seeing if it crashes. (With a semi-recent gcc or clang.)

yeah, but I now use MS VC (Windows project), but sure I can try with clang ...

>
> /Jorgen
>


-- 
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi 
bili naoruzani. -- Mladen Gogala

[toc] | [prev] | [next] | [standalone]


#148054

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2019-11-17 09:30 +0000
Message-ID<slrnqt24oo.2ntj.grahn+nntp@frailea.sa.invalid>
In reply to#148053
On Sun, 2019-11-17, Melzzzzz wrote:
> On 2019-11-17, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
>> On Sat, 2019-11-16, Melzzzzz wrote:
>>> On 2019-11-16, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>>> On 11/15/2019 2:35 PM, Melzzzzz wrote:
>>>>> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
...
>>>>>> Good! You should really be running your work through AddressSanitizer,
>>>>>> ThreadSanitizer and Relacy to help check for these things. They help
>>>>>> kick the shi% out of your code.
>>>>> What code?
>>>>> 
>>>>
>>>> Interesting question! Humm... Still, these tools are pretty nice.
>>>
>>> I stick to as much as possible simple code. Too old...
>>
>> Running the sanitizers is just a matter of recompiling with something
>> like -fsanitize=address,leak,undefined, running your program and
>> seeing if it crashes. (With a semi-recent gcc or clang.)
>
> yeah, but I now use MS VC (Windows project), but sure I can try with clang ...

Ah, sorry -- I was assuming Unix.  There may be similar features in
the Windows ecosystem, but I'm unfamiliar with them.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#148058

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2019-11-17 13:53 -0800
Message-ID<qqsfgs$11c3$1@gioia.aioe.org>
In reply to#148054
On 11/17/2019 1:30 AM, Jorgen Grahn wrote:
> On Sun, 2019-11-17, Melzzzzz wrote:
>> On 2019-11-17, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
>>> On Sat, 2019-11-16, Melzzzzz wrote:
>>>> On 2019-11-16, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>>>>> On 11/15/2019 2:35 PM, Melzzzzz wrote:
>>>>>> On 2019-11-15, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> ...
>>>>>>> Good! You should really be running your work through AddressSanitizer,
>>>>>>> ThreadSanitizer and Relacy to help check for these things. They help
>>>>>>> kick the shi% out of your code.
>>>>>> What code?
>>>>>>
>>>>>
>>>>> Interesting question! Humm... Still, these tools are pretty nice.
>>>>
>>>> I stick to as much as possible simple code. Too old...
>>>
>>> Running the sanitizers is just a matter of recompiling with something
>>> like -fsanitize=address,leak,undefined, running your program and
>>> seeing if it crashes. (With a semi-recent gcc or clang.)
>>
>> yeah, but I now use MS VC (Windows project), but sure I can try with clang ...
> 
> Ah, sorry -- I was assuming Unix.  There may be similar features in
> the Windows ecosystem, but I'm unfamiliar with them.

I don't think MSVC has a builtin race detector. I tend to use Relacy a 
lot on Windows for certain things. Its an interesting program.

[toc] | [prev] | [next] | [standalone]


#148055

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-17 10:27 +0100
Message-ID<qqr3qd$tou$1@news.albasani.net>
In reply to#148053
>> Running the sanitizers is just a matter of recompiling with something
>> like -fsanitize=address,leak,undefined, running your program and
>> seeing if it crashes. (With a semi-recent gcc or clang.)

> yeah, but I now use MS VC (Windows project), but sure I can try with clang ...

MSVC has iterator-debugging when you strictly use C++-iterators.
They make these sanitizers irrelevant as long as you follow C++
-patterns.

[toc] | [prev] | [next] | [standalone]


#148056

FromMelzzzzz <Melzzzzz@zzzzz.com>
Date2019-11-17 09:44 +0000
Message-ID<XD8AF.90359$7z4.57988@fx09.am4>
In reply to#148055
On 2019-11-17, Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>> Running the sanitizers is just a matter of recompiling with something
>>> like -fsanitize=address,leak,undefined, running your program and
>>> seeing if it crashes. (With a semi-recent gcc or clang.)
>
>> yeah, but I now use MS VC (Windows project), but sure I can try with clang ...
>
> MSVC has iterator-debugging when you strictly use C++-iterators.
> They make these sanitizers irrelevant as long as you follow C++
> -patterns.

Thanks, I'll look into that feature. Didn't do Windows for 20 years and
now I am on Windows project :P

>


-- 
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi --  Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi 
bili naoruzani. -- Mladen Gogala

[toc] | [prev] | [next] | [standalone]


#148057

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-17 10:50 +0100
Message-ID<qqr55d$isv$1@news.albasani.net>
In reply to#148056
>> MSVC has iterator-debugging when you strictly use C++-iterators.
>> They make these sanitizers irrelevant as long as you follow C++
>> -patterns.

> Thanks, I'll look into that feature. Didn't do Windows for 20 years and
> now I am on Windows project :P

https://docs.microsoft.com/en-us/cpp/standard-library/debug-iterator-support?view=vs-2019
https://docs.microsoft.com/en-us/cpp/standard-library/iterator-debug-level?view=vs-2019

https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html

https://libcxx.llvm.org/docs/DesignDocs/DebugMode.html

[toc] | [prev] | [next] | [standalone]


#148046

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-16 07:26 +0100
Message-ID<qqo4pn$rl5$2@news.albasani.net>
In reply to#148036
>> The above bug led to a unecessarily large buffer-allocation.
>> I already fixed that.

> Good! You should really be running your work through AddressSanitizer, 
> ThreadSanitizer and Relacy to help check for these things. They help 
> kick the shi% out of your code.

AddressSanitizer doesn't check for buffers that are too large.
The VC++ STL has bounds-checking iterators, so I don't need to
check for overflows with AddressSanitizer. And ThreadSanitizer
check's for data-races; there are none in my code.

[toc] | [prev] | [next] | [standalone]


#147785

FromBonita Montero <Bonita.Montero@gmail.com>
Date2019-11-08 18:07 +0100
Message-ID<qq47cr$4o7$1@news.albasani.net>
In reply to#147781
There were two little bugs. I just reorganized the code from
C++ wihtout running it. The following code should be fine:

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <assert.h>

int merge_sort( int *start, size_t n );

int main()
{
     size_t const N = 100000000;
     int *p = malloc( N * sizeof(int) );
     printf( "randomizing ...\n" );
     int *s = p;
     for( s = p; s != p + N; *s++ = rand() );
     printf( "sorting ...\n" );
     merge_sort( p, N );
     for( int *scn = p; scn < p + N - 1; ++scn )
         assert( scn[0] <= scn[1] );
     printf( "... sorted\n" );
}

void ms_recursion( int *start, int *end, int *buf );

int merge_sort( int *start, size_t n )
{
     size_t bs = 0;
     for( size_t nHalf = n; nHalf > 1; bs += nHalf, nHalf -= nHalf / 2 );
     int *buf = malloc( bs * sizeof(int) );
     if( !buf )
         return 0;
     ms_recursion( start, start + n, buf );
     free( buf );
     return 1;
}

void ms_recursion( int *start, int *end, int *buf )
{
     if( end - start <= 1 )
         return;
     for( int *from = start, *to = buf; from != end; *to++ = *from++ );
     size_t  n          = end - start;
     int    *leftBuf    = buf,
            *leftBufEnd = buf + n / 2,
            *rightBuf   = leftBufEnd,
            *bufEnd     = buf + n;
     ms_recursion( leftBuf,  leftBufEnd, bufEnd );
     ms_recursion( rightBuf, bufEnd,     bufEnd );
     for( int *wrtBack = start; ; )
         if( *leftBuf <= *rightBuf )
         {
             *wrtBack++ = *leftBuf;
             if( ++leftBuf == leftBufEnd )
             {
                 do
                     *wrtBack++ = *rightBuf;
                 while( ++rightBuf != bufEnd );
                 break;
             }
         }
         else
         {
             *wrtBack++ = *rightBuf;
             if( ++rightBuf == bufEnd )
             {
                 do
                     *wrtBack++ = *leftBuf;
                 while( ++leftBuf != leftBufEnd );
                 break;
             }
         }
}

[toc] | [prev] | [next] | [standalone]


Page 4 of 11 — ← Prev page 1 2 3 [4] 5 6 … 11  Next page →

Back to top | Article view | comp.lang.c


csiph-web